You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep runner images up to date with a weekly agentic workflow - #4352
This PR adds a weekly gh-aw agentic workflow that keeps the GitHub-hosted runner images that our workflows use up to date. That way we add new images, and stop using retiring ones before their brownouts start, rather than finding out when required checks fail.
The workflow's instructions are in .github/workflows/update-runner-images.md, which gh aw compile compiles to update-runner-images.lock.yml. Copilot compares the runner-images PR check with the runner images README and the open announcements in actions/runner-images, and opens a PR if something needs to change. Most weeks, nothing will. It doesn't propose changes that one of its open PRs already makes.
PRs that are still open after two weeks are closed by agentics-maintenance.yml, a daily workflow that gh aw compile generates. Unchecking a PR's expires line keeps it open. The next run proposes the changes from expired PRs again if they're still needed, so a maintainer should close any PR whose changes we don't want. .github/workflows/aw.json turns off the maintenance workflow's manual operations, which we don't use. gh-aw opens an issue when a run fails, and the maintenance workflow closes those issues after a week.
Dependabot skips both generated workflows, since recompiling would revert its updates. gh aw upgrade updates their actions instead.
The workflow doesn't need a PAT. It uses copilot-requests: write for Copilot requests, and opens PRs with GITHUB_TOKEN, so that their workflow runs wait for a maintainer to approve them before they use the repository's secrets. GITHUB_TOKEN can't push changes to workflows, so the CodeQL CI app pushes the PR's branch, using the existing CODEQL_CI_APP_CLIENT_ID variable and CODEQL_CI_APP_PRIVATE_KEY secret. Only the step that mints the token for that push uses the app's key.
Workflows that run on that push don't wait for approval, so:
The branch names start with runner-images/, so they don't match the push triggers of the workflows that run on main or release branches.
prepare-release.yml and rollback-release.yml run when a branch that changes them is pushed, so the workflow leaves them out of its PRs. As a result, gh-aw puts each PR's changes in a single commit titled "Apply filtered changes".
gh-aw's threat detection checks the agent's changes before they're pushed. The workflow asks its model to flag changes that add a workflow or change an existing workflow's triggers. Before the model runs, a step runs pr-checks/check-workflow-changes.ts, which fails if the changes add, delete or replace a workflow, or change anything in an existing one apart from its jobs, comments and formatting. If the model flags a threat, or detection fails, the run fails without pushing the branch. The model also runs in weeks when nothing needs to change, so a detection failure fails those runs too.
The agent runs in gh-aw's sandbox and can't reach GitHub directly. Its GitHub tools hide issues, PRs and comments whose authors aren't owners, members or collaborators of the item's repository, except PRs from branches in that repository and content from GitHub's own bots, such as github-actions[bot]. The authors of the announcements have the CONTRIBUTOR author association, so the workflow saves the announcements, along with the README, before the agent starts. The agent's PR can only change pr-checks/sync.ts and the YAML files in .github/workflows and pr-checks/checks.
Risk assessment
For internal use only. Please select the risk level of this change:
Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.
Which use cases does this change impact?
Environments:
Testing/None - This change does not impact any CodeQL workflows in production.
How did/will you validate this change?
Other - I ran the workflow on push from a test branch, with failure issues turned off, and had it open draft PRs against the test branch. With ubuntu-24.04-arm removed from the runner-images check, the agent added it back. Threat detection checked the patch, and the workflow opened Test of the runner images agentic workflow (please ignore) #4322 from a runner-images/ branch, whose workflow runs waited for approval. With windows-2022 removed instead, the agent finished without opening a PR, since I'd just closed an earlier test PR that added it back. I haven't tested PR expiry. After adding pr-checks/check-workflow-changes.ts, I ran the workflow from two more test branches. Without windows-2025 in the runner-images check, the script passed and the workflow opened Test of the runner images agentic workflow (please ignore) #4354. When I also asked the agent to add a workflow, the script failed, and the run ended without pushing a branch. I also tested the script locally against changes that delete a workflow, make an existing workflow run on pushes to runner-images/ branches, or only change jobs and comments. After merging, I'll run the workflow on main.
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
Development/testing only - This change cannot cause any failures in production.
How will you know if something goes wrong after this change is released?
Other - Failed Update runner images runs, which gh-aw also reports in an issue.
Are there any special considerations for merging or releasing this change?
No special considerations - This change can be merged at any time.
Merge / deployment checklist
Confirm this change is backwards compatible with existing workflows.
Consider adding a changelog entry for this change.
Confirm the readme and docs have been updated if necessary.
`aw.json` turns off the manual operations in the generated maintenance workflow, which this
repository doesn't use.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The instructions lack approval, completion, and dry-run safeguards for sync-checks.ts --apply, which can replace required checks with an incomplete or empty set on main and supported release branches.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The workflow uses the app’s private key to mint workflow-write tokens even on noop runs, creating unnecessary privileged credentials and risking credential-dependent failures.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Avoid minting privileged tokens on noop runs
.github/workflows/update-runner-images.md:101
This step uses the app's private key and mints a workflow-write token even on noop runs, where no branch is pushed. Could it use the checkout's contains(needs.agent.outputs.output_types, 'create_pull_request') guard to avoid unnecessary privileged tokens and credential-dependent failures on those runs? The lock file would also need regeneration with gh aw compile.
… for a pull request
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a weekly gh-aw agentic workflow that keeps the GitHub-hosted runner images that our workflows use up to date. That way we add new images, and stop using retiring ones before their brownouts start, rather than finding out when required checks fail.
The workflow's instructions are in
.github/workflows/update-runner-images.md, whichgh aw compilecompiles toupdate-runner-images.lock.yml. Copilot compares therunner-imagesPR check with the runner images README and the open announcements in actions/runner-images, and opens a PR if something needs to change. Most weeks, nothing will. It doesn't propose changes that one of its open PRs already makes.PRs that are still open after two weeks are closed by
agentics-maintenance.yml, a daily workflow thatgh aw compilegenerates. Unchecking a PR'sexpiresline keeps it open. The next run proposes the changes from expired PRs again if they're still needed, so a maintainer should close any PR whose changes we don't want..github/workflows/aw.jsonturns off the maintenance workflow's manual operations, which we don't use. gh-aw opens an issue when a run fails, and the maintenance workflow closes those issues after a week.Dependabot skips both generated workflows, since recompiling would revert its updates.
gh aw upgradeupdates their actions instead.The workflow doesn't need a PAT. It uses
copilot-requests: writefor Copilot requests, and opens PRs withGITHUB_TOKEN, so that their workflow runs wait for a maintainer to approve them before they use the repository's secrets.GITHUB_TOKENcan't push changes to workflows, so the CodeQL CI app pushes the PR's branch, using the existingCODEQL_CI_APP_CLIENT_IDvariable andCODEQL_CI_APP_PRIVATE_KEYsecret. Only the step that mints the token for that push uses the app's key.Workflows that run on that push don't wait for approval, so:
runner-images/, so they don't match thepushtriggers of the workflows that run onmainor release branches.prepare-release.ymlandrollback-release.ymlrun when a branch that changes them is pushed, so the workflow leaves them out of its PRs. As a result, gh-aw puts each PR's changes in a single commit titled "Apply filtered changes".pr-checks/check-workflow-changes.ts, which fails if the changes add, delete or replace a workflow, or change anything in an existing one apart from its jobs, comments and formatting. If the model flags a threat, or detection fails, the run fails without pushing the branch. The model also runs in weeks when nothing needs to change, so a detection failure fails those runs too.The agent runs in gh-aw's sandbox and can't reach GitHub directly. Its GitHub tools hide issues, PRs and comments whose authors aren't owners, members or collaborators of the item's repository, except PRs from branches in that repository and content from GitHub's own bots, such as
github-actions[bot]. The authors of the announcements have theCONTRIBUTORauthor association, so the workflow saves the announcements, along with the README, before the agent starts. The agent's PR can only changepr-checks/sync.tsand the YAML files in.github/workflowsandpr-checks/checks.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Environments:
How did/will you validate this change?
ubuntu-24.04-armremoved from therunner-imagescheck, the agent added it back. Threat detection checked the patch, and the workflow opened Test of the runner images agentic workflow (please ignore) #4322 from arunner-images/branch, whose workflow runs waited for approval. Withwindows-2022removed instead, the agent finished without opening a PR, since I'd just closed an earlier test PR that added it back. I haven't tested PR expiry. After addingpr-checks/check-workflow-changes.ts, I ran the workflow from two more test branches. Withoutwindows-2025in therunner-imagescheck, the script passed and the workflow opened Test of the runner images agentic workflow (please ignore) #4354. When I also asked the agent to add a workflow, the script failed, and the run ended without pushing a branch. I also tested the script locally against changes that delete a workflow, make an existing workflow run on pushes torunner-images/branches, or only change jobs and comments. After merging, I'll run the workflow onmain.If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Update runner imagesruns, which gh-aw also reports in an issue.Are there any special considerations for merging or releasing this change?
Merge / deployment checklist