spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Use workload identity federation for Claude auth in CI workflows (#61584)Browse files
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 Bhat authored on May 22, 2026 · GitHub committed on May 22, 2026 parent 64e5382 · commit 5ef2f06c6aa0
3 changed files+25 -3compared with 64e5382
M.github/workflows/claude-dedupe-issues.yml
M.github/workflows/claude-issue-triage.yml
M.github/workflows/claude.yml
@@ -17,6 +17,8 @@
1717 permissions:
1818 contents: read
1919 issues: write
20+ # Required to mint the OIDC token exchanged for a Claude API access token (Workload Identity Federation)
21+ id-token: write
2022
2123 steps:
2224 - name: Checkout repository
@@ -31,7 +33,13 @@
3133 github_token: ${{ secrets.GITHUB_TOKEN }}
3234 allowed_non_write_users: "*"
3335 prompt: "/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}"
34- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
36+ # Authenticate to the Claude API via Workload Identity Federation
37+ # (the workflow's OIDC token is exchanged for a short-lived access
38+ # token) instead of a static API key.
39+ anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
40+ anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
41+ anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
42+ anthropic_workspace_id: ${{ vars.ANTHROPIC_WORKSPACE_ID }}
3543 claude_args: "--model claude-sonnet-4-5-20250929"
3644
3745 - name: Log duplicate comment event to Statsig
@@ -18,6 +18,8 @@
1818 permissions:
1919 contents: read
2020 issues: write
21+ # Required to mint the OIDC token exchanged for a Claude API access token (Workload Identity Federation)
22+ id-token: write
2123
2224 steps:
2325 - name: Checkout repository
@@ -34,6 +36,12 @@
3436 github_token: ${{ secrets.GITHUB_TOKEN }}
3537 allowed_non_write_users: "*"
3638 prompt: "/triage-issue REPO: ${{ github.repository }} ISSUE_NUMBER: ${{ github.event.issue.number }} EVENT: ${{ github.event_name }}"
37- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
39+ # Authenticate to the Claude API via Workload Identity Federation
40+ # (the workflow's OIDC token is exchanged for a short-lived access
41+ # token) instead of a static API key.
42+ anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
43+ anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
44+ anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
45+ anthropic_workspace_id: ${{ vars.ANTHROPIC_WORKSPACE_ID }}
3846 claude_args: |
3947 --model claude-opus-4-6
@@ -33,6 +33,12 @@
3333 id: claude
3434 uses: anthropics/claude-code-action@v1
3535 with:
36- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
36+ # Authenticate to the Claude API via Workload Identity Federation
37+ # (the workflow's OIDC token is exchanged for a short-lived access
38+ # token) instead of a static API key.
39+ anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
40+ anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
41+ anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
42+ anthropic_workspace_id: ${{ vars.ANTHROPIC_WORKSPACE_ID }}
3743 claude_args: "--model claude-sonnet-4-5-20250929"
3844