fix: restore actions/setup in upload_assets job after git branch switch (dev mode)#23604
fix: restore actions/setup in upload_assets job after git branch switch (dev mode)#23604
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2389e37d-a4ad-417c-8b1d-6a1c189d9003 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Restores the local ./actions/setup action directory in upload_assets jobs after switching the workspace to an orphan assets/ branch in dev mode, preventing GitHub Actions runner post-step failures.
Changes:
- Add a dev-mode
PostStepsrestore checkout (actions/setupvia sparse checkout) to the generatedupload_assetsjob. - Recompile workflow
.lock.ymlfiles soupload_assetsjobs include the “Restore actions folder” step at the end.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/publish_assets.go | Adds a dev-mode post-step to restore actions/setup after the assets-branch checkout. |
| .github/workflows/weekly-issue-summary.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/weekly-editors-health-check.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/unbloat-docs.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/technical-doc-writer.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/stale-repo-identifier.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/python-data-charts.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/portfolio-analyst.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/poem-bot.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/org-health-report.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/github-mcp-structural-analysis.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/docs-noob-tester.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/deep-report.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-repo-chronicle.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-performance-summary.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-news.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-multi-device-docs-tester.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-issues-report.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-integrity-analysis.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-firewall-report.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-copilot-token-report.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/daily-code-metrics.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/copilot-session-insights.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/copilot-pr-nlp-analysis.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
| .github/workflows/audit-workflows.lock.yml | Appends “Restore actions folder” step to upload_assets job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var postSteps []string | ||
| if c.actionMode.IsDev() { | ||
| postSteps = append(postSteps, c.generateRestoreActionsSetupStep()) | ||
| publishAssetsLog.Print("Added restore actions folder step to upload_assets job (dev mode)") | ||
| } |
There was a problem hiding this comment.
The new dev-mode behavior appends a "Restore actions folder" post-step, but there’s no unit test coverage asserting that this step is (a) present in dev mode and (b) omitted in non-dev modes. Please extend the existing publish_assets tests to validate the generated job steps include this restore checkout when actionMode=dev, and do not include it for release/actio 8000 n/script modes.
In dev mode, the
upload_assetsjob uses./actions/setupas a local action, soactions/setup/action.ymllives in the workspace. The job then switches the workspace to the orphanedassets/branch viagit checkout -B, which removes all regular repo files — includingaction.yml. The GitHub Actions runner's post-step forSetup Scriptsthen fails:Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '.../actions/setup'.Changes
pkg/workflow/publish_assets.go— addsgenerateRestoreActionsSetupStep()as aPostStepinbuildUploadAssetsJobwhenc.actionMode.IsDev(). This sparse-checks out onlyactions/setupback into the workspace withif: always(), ensuring the post-action can always findaction.ymland complete its/tmp/gh-awcleanup.This is the same pattern already applied in
repo_memory.goandcompiler_safe_outputs_job.gofor the same class of problem..lock.ymlfiles — all workflows using theupload-assetsafe output now include the restore step at the end of theirupload_assetsjob: