GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — Use workload identity federation for Claude auth in CI workflows by ashwin-ant · Pull Request #984 · anthropics/claude-agent-sdk-python Conversation
Collaborator
WhatSwitches this repository's Claude automation workflows from the static
This uses the federation support shipped in anthropics/claude-code-action ( How it activatesThe federation rule, organization, service account, and workspace IDs are read from repository variables ( The Behavior notes
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsReplace the static ANTHROPIC_API_KEY secret with Workload Identity Federation inputs in claude.yml, claude-code-review.yml, claude-issue-triage.yml, and build-and-publish.yml. The federation rule, organization, service account, and workspace IDs are read from repository variables. Grant id-token: write where it was missing, including in the jobs of auto-release.yml and publish.yml that call the build-and-publish.yml reusable workflow.
MaxLeiter
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
shasudo
pushed a commit
to shasudo/claude-agent-sdk-python
that referenced
this pull request
…hropics#984) ## What Switches this repository's Claude automation workflows from the static `ANTHROPIC_API_KEY` secret to [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/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 | | `claude-code-review.yml` | `anthropic_api_key` → federation inputs | | `claude-issue-triage.yml` | `anthropic_api_key` → federation inputs, plus `id-token: write` (the other two already request it) | | `build-and-publish.yml` | `anthropic_api_key` → federation inputs in the changelog step, plus `id-token: write` on the `publish` job | | `auto-release.yml`, `publish.yml` | grant `id-token: write` to the jobs that call the `build-and-publish.yml` reusable workflow (a called workflow can only use permissions its caller grants) | This uses the federation support shipped in [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action) (`docs/setup.md#workload-identity-federation`, anthropics/claude-code-action#1338). ## 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 - `claude-code-review.yml` runs on `pull_request`. Fork PRs don't receive `id-token: write` (GitHub withholds it the same way it withholds secrets), so reviews continue to run only for same-repo PRs — identical to today's behavior with the secret. - `test.yml` is deliberately **not** migrated here: it passes `ANTHROPIC_API_KEY` directly to pytest and to `docker run` for the SDK under test. Migrating that path means mounting an identity token into the container rather than swapping a workflow input, so it needs its own treatment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |