Skip to content

Use GITHUB_TOKEN for Copilot CLI inference in agentic workflows#1469

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers/gh-aw-copilot-requests-permission
Jun 16, 2026
Merged

Use GITHUB_TOKEN for Copilot CLI inference in agentic workflows#1469
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers/gh-aw-copilot-requests-permission

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

Adopt the new GitHub Agentic Workflows authentication model so the agentic workflow in this repo no longer needs a stored PAT for Copilot CLI inference.

What changed

  • Added copilot-requests: write to the permissions: block in .github/workflows/java-interop-reviewer.md (the only agentic workflow in this repo).
  • Recompiled with gh aw compile. The regenerated *.lock.yml now wires COPILOT_GITHUB_TOKEN: ${{ github.token }} and no longer references secrets.COPILOT_GITHUB_TOKEN. AI credits are billed to the org.
  • Bumped the gh-aw CLI to v0.79.8 (.github/aw/actions-lock.json + .github/workflows/agentics-maintenance.yml) — the changelog requires running the latest CLI to pick up the new compile behavior.

After merge

  • The COPILOT_GITHUB_TOKEN repo (or org) secret can be deleted once nothing else references it. A repo-wide search shows no remaining secrets.COPILOT_GITHUB_TOKEN usage after this PR.

Org prerequisite (one-time)

The org must have the "Allow use of Copilot CLI billed to the organization" Copilot policy enabled. Per the changelog, this is on by default if the existing "Copilot CLI" policy is enabled, so no action is typically needed.

Intentionally NOT changed

Other secrets/PATs in agentic workflows govern safe-outputs, MCP servers, and cross-repo writes — they are unrelated to Copilot inference and are left as-is (e.g. GH_AW_GITHUB_TOKEN, GH_AW_GITHUB_MCP_SERVER_TOKEN). This repo does not use ANDROID_TEAM_PAT.

Reference

GitHub announced on 2026-06-11 that gh-aw can use the built-in
GITHUB_TOKEN for Copilot CLI inference instead of a stored PAT, with
AI credits billed to the org.

Adding `copilot-requests: write` to the workflow permissions block opts
in. After recompiling, the lock file now wires
`COPILOT_GITHUB_TOKEN: ${{ github.token }}` and no longer references
`secrets.COPILOT_GITHUB_TOKEN`.

Also bumped gh-aw CLI to v0.79.8 to pick up the new compile behavior.

See: https://github.blog/changelog/2026-06-11-agentic-workflows-no-longer-need-a-personal-access-token/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 15, 2026 22:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repo’s agentic workflows to use the new GitHub Agentic Workflows authentication model so Copilot CLI inference can use the workflow GITHUB_TOKEN (org-billed) instead of requiring a stored PAT/secret.

Changes:

  • Adds copilot-requests: write permission to the source agentic workflow (java-interop-reviewer.md).
  • Regenerates the compiled lock workflow to use COPILOT_GITHUB_TOKEN: ${{ github.token }} and updates related guardrail/output naming.
  • Bumps gh-aw action/CLI references to v0.79.8 and updates the actions lock JSON accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/java-interop-reviewer.md Adds copilot-requests: write permission to enable Copilot inference with GITHUB_TOKEN.
.github/workflows/java-interop-reviewer.lock.yml Regenerated workflow: switches Copilot auth to ${{ github.token }}, updates gh-aw versions, and adjusts related runtime/env wiring.
.github/workflows/agentics-maintenance.yml Updates generated maintenance workflow to use gh-aw actions/CLI v0.79.8.
.github/aw/actions-lock.json Updates pinned gh-aw action entries to v0.79.8 + new SHA.

Comment thread .github/workflows/java-interop-reviewer.lock.yml
@jonathanpeppers jonathanpeppers merged commit b3750e4 into main Jun 16, 2026
3 checks passed
@jonathanpeppers jonathanpeppers deleted the jonathanpeppers/gh-aw-copilot-requests-permission branch June 16, 2026 13:56
jonathanpeppers added a commit that referenced this pull request Jun 16, 2026
PR #1469 added `copilot-requests: write` to the java-interop-reviewer
workflow permissions block to opt into the new feature where gh-aw uses
the built-in GITHUB_TOKEN for Copilot CLI inference, with AI credits
billed to the org.

That feature requires the "Allow use of Copilot CLI billed to the
organization" Copilot policy to be enabled at the org level. The dotnet
org has not enabled that policy yet, so the workflow now fails with HTTP
403 from api.githubcopilot.com/models. See failing run:
https://github.com/dotnet/java-interop/actions/runs/27628125187/job/81695629467

Revert just the opt-in line in java-interop-reviewer.md and recompile
the lock file. After this merges, the COPILOT_GITHUB_TOKEN secret needs
to be re-added to the copilot-pr-reviewer environment so the PAT-based
flow works again.

Also revert max-ai-credits from 100M back to -1 (truly unlimited). PR
#1472 capped it at 100M based on a wrong theory that -1 was causing the
auth 403; that 403 reproduced under 100M too, so the cap wasn't the
issue and the user prefers -1.

The gh-aw CLI v0.79.8 bump and the agentics-maintenance.yml updates
from PR #1469 are intentionally left in place.

See: https://github.blog/changelog/2026-06-11-agentic-workflows-no-longer-need-a-personal-access-token/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jonathanpeppers added a commit that referenced this pull request Jun 16, 2026
)

PR #1469 added `copilot-requests: write` to the java-interop-reviewer
workflow permissions block to opt into the new feature where gh-aw uses
the built-in GITHUB_TOKEN for Copilot CLI inference, with AI credits
billed to the org.

That feature requires the "Allow use of Copilot CLI billed to the
organization" Copilot policy to be enabled at the org level. The dotnet
org has not enabled that policy yet, so the workflow now fails with HTTP
403 from api.githubcopilot.com/models. See failing run:
https://github.com/dotnet/java-interop/actions/runs/27628125187/job/81695629467

Revert just the opt-in line in java-interop-reviewer.md and recompile
the lock file. After this merges, the COPILOT_GITHUB_TOKEN secret needs
to be re-added to the copilot-pr-reviewer environment so the PAT-based
flow works again.

Also revert max-ai-credits from 100M back to -1 (truly unlimited). PR
#1472 capped it at 100M based on a wrong theory that -1 was causing the
auth 403; that 403 reproduced under 100M too, so the cap wasn't the
issue and the user prefers -1.

The gh-aw CLI v0.79.8 bump and the agentics-maintenance.yml updates
from PR #1469 are intentionally left in place.

See: https://github.blog/changelog/2026-06-11-agentic-workflows-no-longer-need-a-personal-access-token/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants