GitHub Agentic Workflows

Token Reference

This page is a consolidated reference for every token and secret used by GitHub Agentic Workflows — where each comes from, what permissions it needs, and what it is used for.

Secret NamePurposeRequired?Fallback
COPILOT_GITHUB_TOKENCopilot CLI authenticationYes (Copilot engine)None
ANTHROPIC_API_KEYClaude engine authenticationYes (Claude engine)None
OPENAI_API_KEYCodex engine authenticationYes (Codex engine)CODEX_API_KEYOPENAI_API_KEY
GEMINI_API_KEYGemini engine authenticationYes (Gemini engine)None
GH_AW_GITHUB_MCP_SERVER_TOKENGitHub MCP server authenticationOptionalGH_AW_GITHUB_TOKENGITHUB_TOKEN
GH_AW_GITHUB_TOKENGeneral-purpose GitHub tokenOptionalGITHUB_TOKEN
GH_AW_AGENT_TOKENAssign AI agents to issues/PRsOptionalGH_AW_GITHUB_TOKENGITHUB_TOKEN
GH_AW_PROJECT_GITHUB_TOKENGitHub Projects v2 operationsYes (Projects)None
GH_AW_CI_TRIGGER_TOKENTrigger CI on workflow-created PRsYes (CI trigger)None
GH_AW_PLUGINS_TOKENAPM plugin/dependency accessOptionalGH_AW_GITHUB_TOKENGITHUB_TOKEN
APP_ID / APP_PRIVATE_KEYGitHub App authenticationOptionalPAT-based tokens
GITHUB_TOKENDefault GitHub Actions tokenAutomaticNone (always available)

These tokens authenticate the AI coding agent. Exactly one is required, depending on which engine your workflow uses.

Authenticates the GitHub Copilot CLI as the AI engine.

PropertyValue
SourceUser-created fine-grained PAT stored as repository secret
RequiredYes, when using engine: copilot (the default engine)
PermissionsAccount permission: Copilot Requests: Read
Resource ownerMust be the user’s personal account, not an organization
FallbackNone — the GITHUB_TOKEN does not have Copilot permissions
Used byCopilot CLI inference step, secret validation, Copilot-related safe outputs

When the copilot-requests feature flag is enabled, the compiler uses ${{ github.token }} instead of this secret, allowing the built-in GitHub Actions token to authenticate Copilot directly.

Setup:

Terminal window
gh aw secrets set COPILOT_GITHUB_TOKEN --value "<your-fine-grained-pat>"

See Authentication for detailed setup instructions.


Authenticates the Claude by Anthropic engine.

PropertyValue
SourceAnthropic API key stored as repository secret
RequiredYes, when using engine: claude
PermissionsAnthropic API access (external service)
FallbackNone
Used byClaude inference step
Terminal window
gh aw secrets set ANTHROPIC_API_KEY --value "<your-anthropic-api-key>"

Authenticates the Codex by OpenAI engine.

PropertyValue
SourceOpenAI API key stored as repository secret
RequiredYes, when using engine: codex
PermissionsOpenAI API access (external service)
FallbackBoth CODEX_API_KEY and OPENAI_API_KEY are accepted; the runtime tries CODEX_API_KEY first (${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}). No fallback to GITHUB_TOKEN.
Used byCodex inference step
Terminal window
gh aw secrets set OPENAI_API_KEY --value "<your-openai-api-key>"

Authenticates the Gemini by Google engine.

PropertyValue
SourceGoogle AI Studio API key stored as repository secret
RequiredYes, when using engine: gemini
PermissionsGoogle AI Studio API access (external service)
FallbackNone
Used byGemini inference step
Terminal window
gh aw secrets set GEMINI_API_KEY --value "<your-gemini-api-key>"

These tokens control access to the GitHub API across different parts of a compiled workflow.

The primary token for authenticating GitHub API operations through the GitHub MCP server. This is a “magic secret” — if present in repository secrets, it is automatically used without being referenced in your workflow frontmatter.

PropertyValue
SourceUser-created PAT stored as repository secret
RequiredDepends on mode — required for remote mode and lockdown mode
PermissionsDepends on toolsets used (e.g., repo scope for repos toolset, project scope for projects)
FallbackGH_AW_GITHUB_TOKENGITHUB_TOKEN
Used byGitHub MCP server (local and remote modes), guard policy enforcement

How the magic secret works: The compiler automatically injects this token into the workflow-level environment. You do not need to reference it in your frontmatter — if the secret exists in your repository, it is used. The resolved expression is:

${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

When additional permissions are needed:

  • Remote mode: Requires a PAT (classic or fine-grained) — the default GITHUB_TOKEN is not sufficient
  • Lockdown mode: Requires a PAT for elevated access control
  • Projects toolset: Requires project scope (see Authentication (Projects))
  • Cross-repository access: Requires access to the target repositories
Terminal window
gh aw secrets set GH_AW_GITHUB_MCP_SERVER_TOKEN --value "<your-pat>"

A general-purpose GitHub token that serves as a fallback across multiple token chains. Use this when you want a single PAT to cover multiple workflow operations without configuring purpose-specific tokens.

PropertyValue
SourceUser-created PAT stored as repository secret
RequiredOptional — provides a middle-tier fallback
PermissionsDepends on operations (typically repo scope)
FallbackGITHUB_TOKEN
Used byMCP server (when GH_AW_GITHUB_MCP_SERVER_TOKEN is not set), safe outputs, agent assignment, APM dependencies

This token appears in the fallback chain of almost every token resolution function. It is a good choice when you need a PAT with broader permissions than GITHUB_TOKEN but don’t want to configure multiple purpose-specific secrets.


The default token automatically provided by GitHub Actions to every workflow run. It is repository-scoped and cannot access cross-repo resources, Projects v2, or trigger other workflows.

PropertyValue
SourceAutomatically provided by GitHub Actions
RequiredNo (always available)
PermissionsRepository-scoped, controlled by workflow permissions: block
FallbackNone (this is the final fallback)
Used byLast-resort fallback for MCP server, safe outputs, gh CLI, checkout steps

These tokens serve specific workflow features and have tailored fallback chains.

Used when a workflow assigns an AI coding agent (e.g., Copilot coding agent) to issues or pull requests via safe outputs.

PropertyValue
SourceUser-created PAT stored as repository secret
RequiredRecommended for agent assignment operations
Permissionsissues: write, pull_requests: write, and bot assignment permissions
FallbackGH_AW_GITHUB_TOKENGITHUB_TOKEN (may lack permissions)
Used byassign-to-copilot safe output, agent assignment steps
Terminal window
gh aw secrets set GH_AW_AGENT_TOKEN --value "<your-pat>"

Used for GitHub Projects v2 operations. This token has no fallback because the default GITHUB_TOKEN cannot access the Projects GraphQL API.

PropertyValue
SourceUser-created PAT stored as repository secret
RequiredYes, for any Projects v2 operation
PermissionsClassic PAT: project + repo scopes. Fine-grained: Organization permissions → Projects: Read and write
FallbackNone — GITHUB_TOKEN cannot access Projects v2
Used byupdate-project, create-project, create-project-status-update safe outputs, projects toolset
Terminal window
gh aw secrets set GH_AW_PROJECT_GITHUB_TOKEN --value "<your-pat>"

For separate read/write tokens, see Authentication (Projects).


Used when a workflow needs to push commits that trigger CI checks on pull requests it creates. This token has no fallback because events created with GITHUB_TOKEN do not trigger other workflow runs by design.

PropertyValue
SourceUser-created PAT stored as repository secret
RequiredYes, when using CI triggering
Permissionscontents: write on the target repository
FallbackNone — GITHUB_TOKEN events cannot trigger workflows
Used byEmpty commit push step for CI triggering on workflow-created PRs
Terminal window
gh aw secrets set GH_AW_CI_TRIGGER_TOKEN --value "<your-pat>"

See Triggering CI for usage details.


Used for APM (Agentic Package Manager) plugin and dependency operations, such as fetching packages from private registries or cross-organization repositories.

PropertyValue
SourceUser-created PAT stored as repository secret
RequiredOptional — only needed for private/cross-org dependencies
Permissionsrepo scope for accessing private repositories containing plugins
FallbackGH_AW_GITHUB_TOKENGITHUB_TOKEN
Used byAPM dependency resolution and installation steps
Terminal window
gh aw secrets set GH_AW_PLUGINS_TOKEN --value "<your-pat>"

For enhanced security, you can configure a GitHub App instead of PATs. App tokens are short-lived, automatically scoped, and revoked at workflow end.

Store the App ID as a repository variable and the private key as a repository secret:

Terminal window
gh variable set APP_ID --body "123456"
gh aw secrets set APP_PRIVATE_KEY --value "$(cat path/to/private-key.pem)"

Reference them in your workflow frontmatter:

tools:
github:
github-app:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: "my-org" # Optional: defaults to current repo owner
repositories: ["repo1", "repo2"] # Optional: defaults to current repo only

When a GitHub App is configured, the compiler generates actions/create-github-app-token steps that mint short-lived installation access tokens at workflow runtime. These tokens:

  • 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

The compiler generates App token mint steps in multiple locations depending on what features your workflow uses:

LocationStep IDUsed For
Pre-activation jobpre-activation-app-tokenMembership checks, skip-if evaluations
Activation jobactivation-app-tokenReactions, status comments, label removal
Agent job (GitHub MCP)github-mcp-app-tokenGitHub MCP server authentication
Safe outputs jobsafe-outputs-app-tokenWrite operations (issues, PRs, comments)
APM dependenciesapm-app-tokenPlugin and dependency access

Each mint step includes github-api-url: ${{ github.api_url }} for GitHub Enterprise compatibility.

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)

See Authentication for full GitHub App setup instructions.


These tokens are set by the compiler at workflow runtime. You do not configure them as repository secrets — they are derived from the tokens above.

An environment variable set on the agent job step that carries the resolved GitHub token into the MCP gateway container. Its value is determined by the token precedence chain and may be a GitHub App token, a custom PAT, or the default GITHUB_TOKEN.

PropertyValue
SourceCompiler-generated from configured tokens
Set onAgent job steps, MCP gateway Docker container
Resolves toApp token → custom github-tokenGH_AW_GITHUB_MCP_SERVER_TOKENGH_AW_GITHUB_TOKENGITHUB_TOKEN

An environment variable passed to the GitHub MCP server Docker container. It carries the same resolved token as GITHUB_MCP_SERVER_TOKEN and is used internally by the MCP server process.

Set on various workflow steps (checkout, gh CLI commands, pre-agentic steps) to authenticate GitHub CLI operations. Typically resolves to ${{ github.token }} or a minted App token.


The compiler uses different precedence chains depending on the operation context. Each chain is a cascade expression — the first non-empty secret wins.

getEffectiveGitHubToken():
1. Custom github-token (from tools.github.github-token)
2. GH_AW_GITHUB_MCP_SERVER_TOKEN
3. GH_AW_GITHUB_TOKEN
4. GITHUB_TOKEN

If a GitHub App is configured, the App token overrides this entire chain.

getEffectiveSafeOutputGitHubToken():
1. Custom github-token (from safe-outputs.<type>.github-token)
2. GH_AW_GITHUB_TOKEN
3. GITHUB_TOKEN
getEffectiveCopilotRequestsToken():
1. Custom github-token
2. COPILOT_GITHUB_TOKEN
(no further fallback)
getEffectiveCopilotCodingAgentGitHubToken():
1. Custom github-token
2. GH_AW_AGENT_TOKEN
3. GH_AW_GITHUB_TOKEN
4. GITHUB_TOKEN
getEffectiveProjectGitHubToken():
1. Custom github-token
2. GH_AW_PROJECT_GITHUB_TOKEN
(no further fallback)
getEffectiveCITriggerGitHubToken():
1. Custom github-token
2. GH_AW_CI_TRIGGER_TOKEN
(no further fallback)
getEffectiveAPMGitHubToken():
1. Custom github-token (from dependencies.github-token)
2. GH_AW_PLUGINS_TOKEN
3. GH_AW_GITHUB_TOKEN
4. GITHUB_TOKEN

Many workflow features accept an explicit github-token field that takes highest priority in the precedence chain (above any repository secret):

tools:
github:
github-token: ${{ secrets.MY_CUSTOM_PAT }}
safe-outputs:
create-issue:
github-token: ${{ secrets.MY_ISSUES_PAT }}
update-project:
github-token: ${{ secrets.MY_PROJECT_PAT }}

This allows fine-grained control over which token is used for each operation, independent of the default fallback chains.


Tokens That Do Not Fall Back to GITHUB_TOKEN

Section titled “Tokens That Do Not Fall Back to GITHUB_TOKEN”

Three tokens intentionally have no fallback to GITHUB_TOKEN because the default token lacks the necessary capabilities:

TokenReason GITHUB_TOKEN cannot be used
COPILOT_GITHUB_TOKENGITHUB_TOKEN does not have Copilot Requests permission
GH_AW_PROJECT_GITHUB_TOKENGITHUB_TOKEN is repository-scoped and cannot access the Projects v2 GraphQL API
GH_AW_CI_TRIGGER_TOKENEvents created by GITHUB_TOKEN do not trigger other workflows

If these secrets are not configured and no custom github-token is provided, the relevant workflow steps will fail at runtime.