Skip to content

Commit dbd72dd

Browse files
[gh-aw] Eliminate magic GH_AW_* secret references from lock files (#11685)
The dotnet/android secret-audit report flags every secret name that appears in a compiled workflow, including the "magic" fallback secrets that gh-aw emits as the tail of its token-resolution chain (`GH_AW_GITHUB_TOKEN` and `GH_AW_GITHUB_MCP_SERVER_TOKEN`). Those names showed up in both `*.lock.yml` files even though we never set those secrets in the `copilot-pr-reviewer` environment, because gh-aw bakes the full fallback expression into every safe-output handler and into the GitHub MCP server wiring. Set explicit `github-token: ${{ secrets.GITHUB_TOKEN }}` overrides at two levels so the compiler short-circuits both fallback chains before they reference the magic names: - `safe-outputs.github-token` -> replaces the `safe-output.github-token` -> `GH_AW_AGENT_TOKEN` -> `GH_AW_GITHUB_TOKEN` -> `GITHUB_TOKEN` chain that safe-output handlers (`create-issue`, `create-pull-request-review-comment`, `submit-pull-request-review`) use. - `tools.github.github-token` -> replaces the `GH_AW_GITHUB_MCP_SERVER_TOKEN` -> `GH_AW_GITHUB_TOKEN` -> `GITHUB_TOKEN` chain that the GitHub MCP server container uses. The existing `assign-to-agent.github-token: ${{ secrets.ANDROID_TEAM_PAT }}` override is left alone -- the Copilot assignment API requires a user-owned fine-grained PAT and rejects `GITHUB_TOKEN`. `GITHUB_TOKEN` is the correct choice (not `COPILOT_GITHUB_TOKEN`) for these overrides because `COPILOT_GITHUB_TOKEN` is scoped to "Copilot Requests: Read" only -- it has no `issues: write` / `pull-requests: write` scopes and would 403 on every safe-output write. The safe-output processing jobs that gh-aw generates run with their own elevated `permissions:` block, so the default `GITHUB_TOKEN` already has the scopes they need. After recompiling, the `# Secrets used:` block (and the machine-readable `gh-aw-manifest:` JSON) in each lock file lists only secrets that are actually configured: nightly-fix-finder.lock.yml: ANDROID_TEAM_PAT, COPILOT_GITHUB_TOKEN, GITHUB_TOKEN android-reviewer.lock.yml: COPILOT_GITHUB_TOKEN, GITHUB_TOKEN `gh aw compile` reports 0 errors / 0 warnings on both workflows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 63ab087 commit dbd72dd

4 files changed

Lines changed: 31 additions & 35 deletions

File tree

.github/workflows/android-reviewer.lock.yml

Lines changed: 14 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/android-reviewer.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ network:
2828
- "vsassets.io"
2929
tools:
3030
github:
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
3132
toolsets: [pull_requests, repos]
3233
# Allow reading PR content from external/first-time contributors.
3334
# The /review command is gated to maintainers, so only trusted users can trigger it.
3435
min-integrity: none
3536
safe-outputs:
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
3638
create-pull-request-review-comment:
3739
max: 50
3840
submit-pull-request-review:

0 commit comments

Comments
 (0)