Workload identity federation can replace stored model keys in GitHub Actions. How it works, the rule to get right, and a key audit script.
This article was first published on Medium. The canonical URL is https://medium.com/@r3dtuxedo/your-ci-doesnt-need-a-model-api-key-anymore-mostly-bcf464e7fa4b .
TL;DR
A model API key in CI sits in the same job that reads outside text: pull requests, issues, comments. Anthropic's own docs for its GitHub Action say to avoid "storing a long-lived secret entirely" by using workload identity federation.
How it works: the job gets a GitHub OIDC token (about 5 minutes), swaps it for a short-lived model token, and your rule decides which repo, branch or environment may do that.
The catch is the rule. Anthropic warns that repo:your-org/* without a branch limit also matches pull-request runs from forks, so "anyone who can open a pull request" could get a token.
Status on 28 Nov: Claude Code Action and the Claude API support it.…