Skip to content

Use workload identity federation for Claude auth in CI workflows#61584

Merged
ashwin-ant merged 1 commit into
mainfrom
ci-wif-auth
May 22, 2026
Merged

Use workload identity federation for Claude auth in CI workflows#61584
ashwin-ant merged 1 commit into
mainfrom
ci-wif-auth

Conversation

@ashwin-ant
Copy link
Copy Markdown
Collaborator

What

Switches this repository's Claude automation workflows from the static ANTHROPIC_API_KEY secret to Workload Identity Federation: the workflow's GitHub OIDC token is exchanged for a short-lived Claude API access token at runtime, so no long-lived API key needs to be stored in the repository.

Workflow Change
claude.yml anthropic_api_key → federation inputs (already requests id-token: write)
claude-issue-triage.yml anthropic_api_key → federation inputs, plus id-token: write
claude-dedupe-issues.yml anthropic_api_key → federation inputs, plus id-token: write

This is the same feature claude-code-action ships for its users (anthropics/claude-code-action#1338, docs/setup.md).

How it activates

The federation rule, organization, service account, and workspace IDs are read from repository variables (vars.ANTHROPIC_FEDERATION_RULE_ID, vars.ANTHROPIC_ORGANIZATION_ID, vars.ANTHROPIC_SERVICE_ACCOUNT_ID, vars.ANTHROPIC_WORKSPACE_ID). These are identifiers, not credentials. Until a repo admin sets them, the action fails fast at env validation with a clear "authentication required" message — so this PR is safe to merge ahead of that, and switching over is a settings change rather than another PR.

The ANTHROPIC_API_KEY secret is intentionally left in place until the federated path has produced green runs; rollback is reverting this PR.

Behavior notes

  • These workflows are triggered by issue/comment/review events, so they always run in the base repository context where the OIDC token is available. Fork-triggered pull_request runs don't receive id-token: write (GitHub withholds it the same way it withholds secrets), so behavior for forks is unchanged from the secret-based setup.

Replace the static ANTHROPIC_API_KEY secret with Workload Identity
Federation inputs in claude.yml, claude-issue-triage.yml, and
claude-dedupe-issues.yml. The federation rule, organization, service
account, and workspace IDs are read from repository variables.
@ashwin-ant ashwin-ant merged commit 5ef2f06 into main May 22, 2026
2 checks passed
sjbrenchley89 pushed a commit to sjbrenchley89/claude-code that referenced this pull request Jun 1, 2026
…hropics#61584)

Replace the static ANTHROPIC_API_KEY secret with Workload Identity
Federation inputs in claude.yml, claude-issue-triage.yml, and
claude-dedupe-issues.yml. The federation rule, organization, service
account, and workspace IDs are read from repository variables.
@MaxLeiter MaxLeiter deleted the ci-wif-auth branch June 6, 2026 03:22
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.

2 participants