Skip to content

Fix Action Pin Refresh gh CLI authentication - #36487

Merged
PureWeen merged 1 commit into
mainfrom
pureween-fix-action-updater-auth
Jul 16, 2026
Merged

Fix Action Pin Refresh gh CLI authentication#36487
PureWeen merged 1 commit into
mainfrom
pureween-fix-action-updater-auth

Conversation

@PureWeen

@PureWeen PureWeen commented Jul 9, 2026

Copy link
Copy Markdown
Member

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-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: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c520c36e-e6d8-4bc9-acdc-12ef3494249a
Copilot AI review requested due to automatic review settings July 9, 2026 22:04
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 9, 2026 22:04 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36487

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36487"

Copilot AI left a comment

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.

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_TOKEN from the workflow’s ${{ github.token }} into the agent environment so gh CLI auth uses the workflow token (read-only permissions) instead of the Copilot PAT.
  • Derive the required gh-aw extension version from aw-actions-update.lock.yml’s compiler_version metadata and validate it before installation.
  • Regenerate the compiled .lock.yml to 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

@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 9, 2026 22:07 — with GitHub Actions Inactive
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 9, 2026 22:08 — with GitHub Actions Inactive
@github-actions github-actions Bot added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Jul 9, 2026
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 9, 2026 22:08 — with GitHub Actions Inactive

@kubaflo kubaflo left a comment

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.

🔍 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 gh CLI now authenticates with the workflow's read-only GitHub Actions token (job perms are contents: read), so it can gh extension remove/install the 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_VERSION is now derived from the committed lock's compiler_version metadata via sed, 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-maintained v0.80.9 literal that would silently drift when aw-version-update bumps 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.

@PureWeen
PureWeen merged commit c1dc240 into main Jul 16, 2026
12 of 13 checks passed
@PureWeen
PureWeen deleted the pureween-fix-action-updater-auth branch July 16, 2026 19:43
@github-actions github-actions Bot added this to the .NET 10 SR10 milestone Jul 16, 2026
SyedAbdulAzeemSF4852 pushed a commit to SyedAbdulAzeemSF4852/maui that referenced this pull request Jul 27, 2026
<!-- 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>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants