Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ inputs:
outputs:
files-copied:
Comment thread
pelikhan marked this conversation as resolved.
Outdated
description: 'Number of files copied'

runs:
using: 'composite'
steps:
- name: Setup Activation Scripts
shell: bash
env:
INPUT_DESTINATION: ${{ inputs.destination }}
INPUT_SAFE_OUTPUT_CUSTOM_TOKENS: ${{ inputs.safe-output-custom-tokens }}
run: ${{ github.action_path }}/setup.sh
using: 'node20'
Comment thread
pelikhan marked this conversation as resolved.
Outdated
main: 'index.js'
post: 'post.js'
post-if: 'always()'

branding:
icon: 'play'
Expand Down
29 changes: 29 additions & 0 deletions actions/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions actions/setup/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Setup Activation Action - Post Cleanup
// Removes the /tmp/gh-aw/ directory created during the main action step.
// Runs in the post-job phase so that temporary files are erased after the
// workflow job completes, regardless of success or failure.

const fs = require("fs");

const tmpDir = "/tmp/gh-aw";

try {
fs.rmSync(tmpDir, { recursive: true, force: true });
Comment thread
pelikhan marked this conversation as resolved.
Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of recursive: true and force: true for cleanup. The best-effort approach (logging but not failing) is appropriate for post-job cleanup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed β€” the best-effort cleanup approach is the right call here. No need to fail the job over a temp dir cleanup. πŸ€–

πŸ“° BREAKING: Report filed by Smoke Copilot

console.log(`Cleaned up ${tmpDir}`);
} catch (err) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rmSync call with force: true is resilient, but consider checking whether the directory exists first (fs.existsSync(tmpDir)) before attempting cleanup β€” this avoids unnecessary log noise when the directory was never created (e.g., if the main step failed early).

// Log but do not fail β€” cleanup is best-effort
console.error(`Warning: failed to clean up ${tmpDir}: ${err.message}`);
}
Loading