Repository navigation
Automate agentic workflow recompilation after gh-aw updates - #21022
David Pine (IEvangelist) wants to merge 8 commits into
Conversation
Handle merged Dependabot updates and manual dispatch with verified pinned compiler versions and Aspirey follow-up pull requests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cdfad3fd-5f51-4c95-ab2e-7e29d23b9268
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21022Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21022" |
This comment has been minimized.
This comment has been minimized.
Scope the zizmor dangerous-triggers exception to the closed-PR trigger and document the merged Dependabot/default-branch execution boundary. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cdfad3fd-5f51-4c95-ab2e-7e29d23b9268
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Version capture blocks compilation, queued updates can be lost, and reused PRs can retain stale compiler metadata.
3 open findings
What changed in this PR
Automates Aspire’s agentic workflow recompilation after gh-aw updates, reducing manual compiler-pin synchronization and regeneration.
Changes:
- Adds merged-Dependabot and manual triggers with trusted checkout and delayed write credentials.
- Resolves pinned releases, synchronizes compiler settings, and validates generated changes before publication.
- Adds behavior tests and operational documentation.
| File | Description |
|---|---|
| tests/Infrastructure.Tests/WorkflowScripts/ValidateAgenticWorkflowsTests.cs | Integrates behavior tests and checks workflow safeguards. |
| tests/Infrastructure.Tests/WorkflowScripts/recompile-agentic-workflows.test.js | Tests release detection, synchronization, and publication guards. |
| .github/workflows/recompile-agentic-workflows.yml | Orchestrates compilation, validation, and follow-up PR creation. |
| .github/workflows/recompile-agentic-workflows.js | Implements release selection and changed-path validation. |
| .github/workflows/README.md | Documents automation, manual execution, and required permissions. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Remove the privileged trigger and its zizmor exception. Document the Dependabot secret requirements and guard closed merged PR events in the detector and tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cdfad3fd-5f51-4c95-ab2e-7e29d23b9268
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Capture version output from both streams, isolate concurrency by follow-up branch, and refresh existing PR metadata on manual recompilation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cdfad3fd-5f51-4c95-ab2e-7e29d23b9268
This comment has been minimized.
This comment has been minimized.
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Review identified 1 correctness/workflow sequencing issue: the merged-only recompilation trigger cannot repair pin-only Dependabot PRs before existing generated-file validation rejects them. Validation: 19 new Node tests passed locally; all 8 workflows compiled with gh-aw v0.89.21 in an isolated copy and the validation recompilation produced no drift. Existing PR CI passed all 1,619 Infrastructure tests. No live token-minting or PR-publication test was run.
A Dependabot gh-aw-actions bump rewrites the pinned SHAs but not the version input that selects the compiler. Recompiling with the older compiler reverts the new setup pins, so the compile and drift checks cannot pass before merge. For same-repo Dependabot PRs whose setup-cli pin is ahead of its version input, skip regeneration and drift comparison. Lint and the contract tests still run, and the post-merge recompile PR aligns the compiler and is validated strictly. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e6aa1dbb-e82e-4932-ab30-18094ee1ffc7
This comment has been minimized.
This comment has been minimized.
…compile-agentic-workflows Accept upstream's deletion of ValidateAgenticWorkflowsTests.cs to resolve the modify/delete conflict. Upstream removed the YAML-restating infrastructure tests in #20612. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e6aa1dbb-e82e-4932-ab30-18094ee1ffc7
The Dependabot exemption skipped regeneration and drift checks for the whole PR, so a grouped update that also bumped other actions in generated files (for example actions/checkout) could pass validation and then be reverted by the follow-up recompile. Keep compiling and validating with the pinned compiler. While a compiler update is pending, replace the strict drift check with one that accepts only gh-aw action pin lines and fails on any other difference. Cover it with real-git tests, and run the Node tests from a C# runner so they stay in the AgenticWorkflow contract category. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e6aa1dbb-e82e-4932-ab30-18094ee1ffc7
This comment has been minimized.
This comment has been minimized.
gh aw compile replaces auto-sec.lock.yml with raw compiler output, which removes its publication gates, private-stream suppression, and restricted artifact paths. Apply publication-guard.js after compiling and before linting, as validate-agentic-workflows.yml does, so recompilation PRs keep the hardened lock instead of proposing to strip it. Document the guard in the README's recompilation sequence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e6aa1dbb-e82e-4932-ab30-18094ee1ffc7
Tests selector1 / 99 PR test projects · 0 PR jobs, from 6 changed files. Selected PR test projects (1 / 99)
Selected PR jobs (0)none How these were chosen — grouped by what changed📄 📄 📄 📄 🧪 🧪 Job reasonsnone Selection computed for commit |
|
[automated] Thanks for talking this through! As we discussed, the slash command sounds like a good way to handle regeneration on the original Dependabot PR before merging. Ideally, it would update the compiler version, regenerate the workflows, and push the changes back to that PR, so everything goes through the existing validation together. I’d like us to keep that gate strict for Dependabot too, without relaxing the drift check or skipping cases. That should save the manual regeneration work without leaving |
Sébastien Ros (sebastienros)
left a comment
There was a problem hiding this comment.
Two minor workflow issues are inline: one reliability, one efficiency. Both are fine as follow-ups, and I found no correctness bugs in the detection, drift-classification or publication code.
I'm leaving this as a comment instead of approving because radical's request is still unanswered. It asks to regenerate on the Dependabot PR and keep the drift check strict. It was posted after the latest commit, and this PR still relaxes that check, so that decision should come first.
Also worth weighing in that decision: .github/dependabot.yml puts all actions in one group, and the description says #21048 still fails validation by design. That PR has since closed unmerged, so the Dependabot path only helps once gh-aw has its own group or the design changes.
Checked:
- The workflow reuses
actions/checkout,actions/github-scriptandactions/create-github-app-tokenSHAs already used in this repo, and changes no pins, so this PR needs no allow-list update. - The
2>&1version check matches gh-aw v0.89.17'sgh aw versionoutput. - A normal compile prunes stale gh-aw entries from
actions-lock.json, so that file shouldn't drift from validation's--force-refresh-action-pinsoutput. I read this in the gh-aw source and did not run it.
Not exercised: I reviewed the code only. As the description says, the Dependabot-only validation steps and the Aspirey publish path haven't run on a real runner, and the App's permissions and Dependabot secrets are unconfirmed.
| # Compilation replaces auto-sec.lock.yml with raw output. Reapply its publication | ||
| # gates before linting, as validate-agentic-workflows.yml does. | ||
| node .github/workflows/auto-sec/publication-guard.js | ||
| gh aw lint --shellcheck |
There was a problem hiding this comment.
Nothing tells anyone when this job fails after a Dependabot merge, and that merge has already left main with setup-cli ahead of its version input. Until a follow-up PR lands, every non-Dependabot PR touching agentic inputs fails the strict drift check.
The failure is likely, not just possible. publication-guard.js targets v0.89.17 output and throws on anything it doesn't recognize, so a compiler bump that changes the output stops here with no PR. Missing Dependabot secrets would do the same at the token step. The only signal is a red run on a closed PR.
Please report the failure the way update-actionlint.yml does, with a failure() job calling report-pipeline-failure.js. A Dependabot-triggered run gets a read-only GITHUB_TOKEN, so filing the issue may need the App token. Fine as a follow-up.
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| types: [closed] |
There was a problem hiding this comment.
Without a paths filter, every PR closed in the repo starts a run of this workflow, only for the job-level if to skip it, which adds noise to the Actions history. detect only looks at .github/workflows/ YAML, so PRs that touch nothing there can't matter.
| types: [closed] | |
| types: [closed] | |
| paths: | |
| - '.github/workflows/**' |


Description
Keep generated agentic workflows and compiler settings aligned after gh-aw action updates without requiring a maintainer to recompile them locally.
pull_request: closedfor merged upstream Dependabot PRs targeting the default branch, including grouped GitHub Actions updates. Nopull_request_targettrigger or dangerous-trigger suppression is used.gh aw upgrade, and reapply theauto-secpublication guard to the regenerated lock file, as validation does.setup-clipin is ahead of itsversioninput,validate-agentic-workflows.ymlstill compiles and lints with the pinned compiler, which reverts the new gh-aw action pins. The strict generated-file check is replaced by one that tolerates differences in gh-aw action pin lines only; any other drift fails. The recompile PR created after the merge aligns the compiler and is validated strictly.Fixes # (issue)
Limitation
Dependabot groups all GitHub Actions updates into one PR. A grouped PR that also bumps other actions pinned in generated workflows (for example
actions/upload-artifactin #21048) still fails validation, because recompilation reverts those pins and only gh-aw pin lines are tolerated. A separate Dependabot group forgithub/gh-aw-actions*would let gh-aw-only bumps pass; it is not part of this PR.Security considerations
Both execution paths check out only the trusted default branch; the Dependabot path requires a closed, merged upstream Dependabot PR, and manual dispatch is restricted to the default branch.
GITHUB_TOKENis explicitly limited to Contents and Pull requests read permissions. Write credentials are minted only after successful compilation, linting, and changed-path validation. The tolerance invalidate-agentic-workflows.ymlis a hygiene control, not a security boundary: that workflow runs from the PR's own tree with read-only contents access, applies only to same-repo Dependabot PRs, and leaves every other PR strict.Deployment prerequisites:
ASPIRE_BOT_APP_IDandASPIRE_BOT_PRIVATE_KEYas both Actions secrets (manual runs) and Dependabot secrets (Dependabot-triggered runs), using the same names. GitHub does not expose normal Actions secrets to Dependabot-triggeredpull_requestworkflows, including manual reruns. Neither name was present in the repository-level Dependabot secrets listing; organization-level availability was not verified. See GitHub's guidance and zizmor's remediation.Test coverage changes
Merging
mainremovesValidateAgenticWorkflowsTests.cs, which #20612 deleted along with other tests that asserted on workflow YAML. Following.github/instructions/infrastructure-tests.instructions.md, this PR drops the two YAML-asserting tests it had added to that file:RecompilationUsesTrustedCheckoutAndDefersWriteCredentialsrecompile-agentic-workflows.ymlchecking out untrusted content, or minting write credentials before compile and lintPendingDependabotCompilerUpdatesSkipOnlyRegenerationAndDriftCheckscheckGeneratedDriftandcompilerUpdatePendingbehavior testsif:conditions) is not test-coveredRecompilationAutomationHandlesDependabotUpdatesmoved toRecompileAgenticWorkflowsScriptTests.cs. It runs the Node suite throughNodeCommandand keeps theAgenticWorkflowtrait, so the validation workflow's contract step still runs it. Eight new Node tests callcheckGeneratedDriftand thegenerated-driftcommand against real temporary git repositories: tolerated gh-aw pin lines, a grouped update whose other action pins are rejected, changed, added, and removed lines, untracked, deleted, and action-cache changes, mode and binary changes, and output capping.The
publication-guard.jsstep inrecompile-agentic-workflows.ymlhas no workflow-level test either.AutoSecWorkflowTestscover the guard's behavior, and strict validation of the follow-up PR reapplies the guard, so a missing step would surface there as generated-file drift.Validation
.\restore.cmd— passed; installed the11.0.100-rc.2.26504.105SDK thatglobal.jsonpins after the merge.node --test tests\Infrastructure.Tests\WorkflowScripts\recompile-agentic-workflows.test.js— passed, 33 tests (25 existing, 8 new). Loosening the pin classifier to accept anyuses:line failed exactly the three tests covering the grouped-update, other-differences, and command cases; the change was reverted..\.dotnet\dotnet.exe test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-class '*.RecompileAgenticWorkflowsScriptTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed, 1 test.--filter-trait "Category=AgenticWorkflow"in place of the class filter, which is the validation workflow's contract selection — 754 passed, 2 failed:ProcessRunnerTests.CapturesStreamsExitCodeAndInvocationContextandProcessRunnerTests.AppliesEnvironmentOverridesOnTopOfInheritedEnvironment. Both fail only on Windows becausebashresolves to the WSL launcher inSystem32, which does not forward the test's environment variables; running that launcher directly reproduces the failing output. These tests andProcessRunnerare identical tomain.actionlint.exe -shellcheck= -pyflakes= .github\workflows\validate-agentic-workflows.yml .github\workflows\recompile-agentic-workflows.ymlusing repository-pinned actionlint 1.7.12 — passed.zizmor.exe --offline --no-progress(1.30.1) on the same two files — no findings.publication-guard.jsstep follows the same compile, guard, lint order asvalidate-agentic-workflows.yml. The job checks out the full default branch, and the guard locatesauto-sec.lock.ymlrelative to its own directory, so the working directory does not matter. The step itself has not run:gh aw compilecannot be replayed locally on Windows.c9a9184a59..b71765ccbd): all 390 changed lines areuses:pin lines. The gh-awsetupandsetup-clipins are tolerated; theactions/download-artifact,actions/upload-artifact, andactions/setup-nodepins are not, so that grouped PR still fails validation by design. Dependabot's own run on it (38888809369) failed the strict drift step on exactly nine generated files, all modified, with no untracked or deleted files.git diff --checkon the files this PR changes — passed.The Dependabot-only steps in
validate-agentic-workflows.ymlhave not run on a real runner; this PR's own run skips them and exercises the strict path. No full build or live Aspirey PR-creation run was performed.Checklist
<remarks />and<code />elements on your triple slash comments?