Conversation
Comprehensive reference documenting all tokens and secrets used by agentic workflows: AI engine tokens, GitHub API tokens, purpose-specific tokens, GitHub App tokens, internal runtime tokens, and full precedence chains for each token resolution context. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new consolidated Token Reference documentation page for GitHub Agentic Workflows, plus navigation and cross-reference updates so it’s discoverable from existing auth docs and the sidebar.
Changes:
- Add
Token Referencepage documenting token purposes, precedence chains, and GitHub App vs PAT behavior - Link to the new page from the existing Authentication reference
- Add the page to the docs sidebar navigation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/src/content/docs/reference/tokens.md | New consolidated reference page for all tokens/secrets, including precedence chains and GitHub App behavior |
| docs/src/content/docs/reference/auth.mdx | Adds a related-docs link to the new Token Reference page |
| docs/astro.config.mjs | Adds “Token Reference” entry to the Reference sidebar |
Comments suppressed due to low confidence (3)
docs/src/content/docs/reference/tokens.md:455
- The statement that missing
COPILOT_GITHUB_TOKENwill cause runtime failure isn’t always true: when thecopilot-requestsfeature flag is enabled, the Copilot engine uses${{ github.token }}instead ofsecrets.COPILOT_GITHUB_TOKEN. Suggest updating this paragraph (or the table row forCOPILOT_GITHUB_TOKEN) to note the feature-flag exception while keeping the “no fallback” behavior for the default mode.
If these secrets are not configured and no custom `github-token` is provided, the relevant workflow steps will fail at runtime.
docs/src/content/docs/reference/tokens.md:84
- The
OPENAI_API_KEYsection lists fallback asCODEX_API_KEY, but the compiler uses${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}for Codex authentication (soCODEX_API_KEYwins when both are present). Consider documenting the fallback asCODEX_API_KEY→OPENAI_API_KEY(and optionally noting both names are accepted).
| **Source** | OpenAI API key stored as repository secret |
| **Required** | Yes, when using `engine: codex` |
| **Permissions** | OpenAI API access (external service) |
| **Fallback** | `CODEX_API_KEY` (alternative secret name) |
| **Used by** | Codex inference step |
docs/src/content/docs/reference/tokens.md:317
- This section states that GitHub App tokens “override all PAT-based tokens” / “always take precedence”, but
assign-to-agentsafe outputs intentionally do not use GitHub App installation tokens (the Copilot assignment API rejects them) and instead fall back toGH_AW_AGENT_TOKEN→GH_AW_GITHUB_TOKEN→GITHUB_TOKENor an explicitgithub-token. Please call out this exception here (similar to the existing note forCOPILOT_GITHUB_TOKEN).
- **Override all PAT-based tokens** — when configured, App tokens take highest precedence
- **Are scoped to the job's `permissions:` block** — the token receives only the permissions declared in your workflow
- **Are automatically revoked** at the end of the workflow run (even on failure)
- **Support repository scoping** — limit access to specific repositories for least privilege
### Where App tokens are minted
The compiler generates App token mint steps in multiple locations depending on what features your workflow uses:
| Location | Step ID | Used For |
|---|---|---|
| Pre-activation job | `pre-activation-app-token` | Membership checks, skip-if evaluations |
| Agent job (GitHub MCP) | `github-mcp-app-token` | GitHub MCP server authentication |
| Safe outputs job | `safe-outputs-app-token` | Write operations (issues, PRs, comments) |
| APM dependencies | `apm-app-token` | Plugin and dependency access |
Each mint step includes `github-api-url: ${{ github.api_url }}` for [GitHub Enterprise compatibility](/gh-aw/troubleshooting/debug-ghe/).
### App token vs PAT precedence
When a GitHub App is configured, it always takes precedence:
GitHub App token (highest priority)
└── Custom github-token field
└── Purpose-specific secret (e.g., GH_AW_GITHUB_MCP_SERVER_TOKEN)
└── GH_AW_GITHUB_TOKEN
└── GITHUB_TOKEN (lowest priority)
> [!NOTE]
> `COPILOT_GITHUB_TOKEN` is the one token that **cannot** use a GitHub App. It must be a fine-grained PAT with Copilot Requests permission on a personal account.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| |---|---|---|---| | ||
| | [`COPILOT_GITHUB_TOKEN`](#copilot_github_token) | Copilot CLI authentication | Yes (Copilot engine) | None | | ||
| | [`ANTHROPIC_API_KEY`](#anthropic_api_key) | Claude engine authentication | Yes (Claude engine) | None | | ||
| | [`OPENAI_API_KEY`](#openai_api_key) | Codex engine authentication | Yes (Codex engine) | `CODEX_API_KEY` | |
There was a problem hiding this comment.
In the quick reference table, the Codex token fallback is shown as OPENAI_API_KEY → CODEX_API_KEY, but the compiler resolves Codex auth using ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }} (i.e., CODEX_API_KEY takes precedence when both are set). Please update the table to match the actual resolution order (or align the implementation if the docs are intended).
This issue also appears in the following locations of the same file:
- line 80
- line 286
- line 454
| | [`OPENAI_API_KEY`](#openai_api_key) | Codex engine authentication | Yes (Codex engine) | `CODEX_API_KEY` | | |
| | [`OPENAI_API_KEY`](#openai_api_key) | Codex engine authentication | Yes (Codex engine) | `CODEX_API_KEY` → `OPENAI_API_KEY` | |
|
wait we already have a tokens page |
pelikhan
left a comment
There was a problem hiding this comment.
let's check that we don't have the same page
|
@pelikhan i asked the agent if there was a comprehensive token guide and it said that there wasn't. |
|
@pelikhan if you search 'token' in the docs a bunch of stuff comes but nothing comprehensive. |
This comment has been minimized.
This comment has been minimized.
Contribution Check FeedbackThanks for the documentation PR, Open review question 🔍There's an active CHANGES_REQUESTED review from Technical accuracy items ✍️The automated Copilot review flagged three issues worth addressing:
Once these are resolved, this should be ready for a final review pass. Looking forward to seeing this land! 🚀 This feedback was generated by the automated Contribution Check workflow.
|
|
@copilot review the auth page |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f47f1723-1148-49ad-8cd5-c3d5eeac6d72 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Reviewed auth.mdx (bdacf9b). The page is accurate and serves its purpose well as a task-oriented setup guide. A few observations:
No changes needed on auth.mdx — it's correct as-is. |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f47f1723-1148-49ad-8cd5-c3d5eeac6d72 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@dsyme you do a bunch of edits around tokens back in the shipping days... didn't we have a tokens page? |
Adds a new Token Reference page (
docs/src/content/docs/reference/tokens.md) that consolidates documentation for all tokens and secrets used by GitHub Agentic Workflows.What's included
COPILOT_GITHUB_TOKEN,ANTHROPIC_API_KEY,OPENAI_API_KEY,GEMINI_API_KEYGH_AW_GITHUB_MCP_SERVER_TOKEN(magic secret),GH_AW_GITHUB_TOKEN,GITHUB_TOKENGH_AW_AGENT_TOKEN,GH_AW_PROJECT_GITHUB_TOKEN,GH_AW_CI_TRIGGER_TOKEN,GH_AW_PLUGINS_TOKENGITHUB_MCP_SERVER_TOKEN,GITHUB_PERSONAL_ACCESS_TOKEN,GH_TOKENChanges
docs/src/content/docs/reference/tokens.mddocs/astro.config.mjs(added Token Reference entry)docs/src/content/docs/reference/auth.mdx(linked to new page)