Fix Action Pin Refresh gh CLI authentication - #36487
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c520c36e-e6d8-4bc9-acdc-12ef3494249a
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36487Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36487" |
There was a problem hiding this comment.
Pull request overview
This PR updates the Action Pin Refresh agentic workflow to ensure the gh CLI can authenticate for gh extension remove/install operations without consuming the Copilot inference PAT, and removes the need to manually keep a hardcoded gh-aw version pin in sync with the compiled lock.
Changes:
- Export
GH_TOKENfrom the workflow’s${{ github.token }}into the agent environment soghCLI auth uses the workflow token (read-only permissions) instead of the Copilot PAT. - Derive the required
gh-awextension version fromaw-actions-update.lock.yml’scompiler_versionmetadata and validate it before installation. - Regenerate the compiled
.lock.ymlto reflect the new environment variable wiring.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/aw-actions-update.md | Adds GH_TOKEN to agent env and switches gh-aw pin logic to read/validate compiler_version from the lock metadata. |
| .github/workflows/aw-actions-update.lock.yml | Regenerated compiled workflow; propagates GH_TOKEN: ${{ github.token }} into the compiled job env. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
kubaflo
left a comment
There was a problem hiding this comment.
🔍 AI-generated review (multi-model: Opus 4.8 · GPT-5.5 · Gemini 3.1 Pro), on behalf of @kubaflo.
✅ LGTM — approving
Tightly-scoped auth fix for the aw-actions-update weekly pin-refresher. Two independent-review passes agree:
- Least-privilege win: the agent's
ghCLI now authenticates with the workflow's read-only GitHub Actions token (job perms arecontents: read), so it cangh extension remove/installthe lock-pinned gh-aw release without borrowing the Copilot inference PAT. The PAT stays limited to inference — a strict reduction in blast radius. - Pin-drift elimination:
GH_AW_PINNED_VERSIONis now derived from the committed lock'scompiler_versionmetadata viased, validated against^v[0-9]+\.[0-9]+\.[0-9]+$, and the workflow fails safe (exit 0, no PR) if the version can't be parsed — never continues on a stale/wrong CLI. This removes the hand-maintainedv0.80.9literal that would silently drift whenaw-version-updatebumps the compiler.
Verified: the recompiled lock still constrains create_pull_request to allowed_files:[".github/aw/actions-lock.json"] with the [actions] title prefix; permissions/write scope unchanged. No regression in the safe-output surface.
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Summary The live manual validation of Action Pin Refresh ([run 29052735587](https://github.com/dotnet/maui/actions/runs/29052735587)) correctly produced a no-op: the runner had gh-aw v0.81.6 preinstalled, but the v0.80.9-compiled workflow needed its matching CLI. `gh extension remove gh-aw` could not authenticate because the agent had only the Copilot inference PAT, and direct binary download was blocked. This follow-up supplies the agent's `GH_TOKEN` from the workflow's existing read-only `${{ github.token }}` permissions, leaving the Copilot PAT limited to inference. It also reads and validates the required gh-aw version from `aw-actions-update.lock.yml` metadata, avoiding manual pin drift when the dedicated version-updater changes the compiler version. ## Scope - `.github/workflows/aw-actions-update.md` - Regenerated `.github/workflows/aw-actions-update.lock.yml` (compiled with gh-aw v0.80.9) The safe-output remains constrained to `.github/aw/actions-lock.json`; permissions and write scope are unchanged. ## Validation - `gh aw compile aw-actions-update` - gh-aw workflow security scanner: `aw-actions-update.md` passed - `gh aw lint .github/workflows/aw-actions-update.lock.yml` reported no lint issues; its local actionlint integration exited 125 due to a tooling error. Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Summary
The live manual validation of Action Pin Refresh (run 29052735587) correctly produced a no-op: the runner had gh-aw v0.81.6 preinstalled, but the v0.80.9-compiled workflow needed its matching CLI.
gh extension remove gh-awcould not authenticate because the agent had only the Copilot inference PAT, and direct binary download was blocked.This follow-up supplies the agent's
GH_TOKENfrom the workflow's existing read-only${{ github.token }}permissions, leaving the Copilot PAT limited to inference. It also reads and validates the required gh-aw version fromaw-actions-update.lock.ymlmetadata, avoiding manual pin drift when the dedicated version-updater changes the compiler version.Scope
.github/workflows/aw-actions-update.md.github/workflows/aw-actions-update.lock.yml(compiled with gh-aw v0.80.9)The safe-output remains constrained to
.github/aw/actions-lock.json; permissions and write scope are unchanged.Validation
gh aw compile aw-actions-updateaw-actions-update.mdpassedgh aw lint .github/workflows/aw-actions-update.lock.ymlreported no lint issues; its local actionlint integration exited 125 due to a tooling error.