Add missing permissions block to claude.yml workflow - #35
Conversation
Every run of this workflow has been failing with: 'Could not fetch an OIDC token. Did you remember to add id-token: write to your workflow permissions?' GitHub Actions defaults to read-only permissions unless a job explicitly requests more, and this workflow never declared any — so the claude-code-action's OIDC token request (needed to mint a short-lived GitHub token for posting PR comments) had nothing to use. Added the permissions block the action documents needing: contents/pull-requests/ issues write plus id-token write for OIDC.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_38995c54-641d-410e-8cdb-503fef4121c2) |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Summary
Every run of the
Claude CodeGitHub Actions workflow (.github/workflows/claude.yml) has been failing with:(confirmed via job logs on multiple recent runs, e.g. run 30807193637)
GitHub Actions jobs default to read-only permissions unless a
permissions:block explicitly grants more. This workflow never declared one, soanthropics/claude-code-action@main's OIDC token request — needed to mint a short-lived GitHub token for posting PR/issue comments — had nothing to work with and failed on every retry.Fix
Added the permissions block the action's docs specify:
contents: write,pull-requests: write,issues: write, andid-token: write.Note — separate issue also observed in the logs
The same failed run's logs also show
ANTHROPIC_API_KEY:(empty) — theANTHROPIC_API_KEYrepository secret isn't set. This permissions fix alone won't make the workflow succeed; the secret still needs to be added via Settings → Secrets and variables → Actions → New repository secret on GitHub (not something I can set from here). Flagging so it's not missed as a second blocker.Test plan
ANTHROPIC_API_KEYsecret, confirm the next PR comment triggers a successfulclaudejob runGenerated by Claude Code
Note
Low Risk
CI-only workflow configuration with no application or data-path changes; scope is limited to granting the Claude action the permissions its docs require.
Overview
The Claude Code workflow (
.github/workflows/claude.yml) was failing because the job had no explicitpermissions, so GitHub kept the default read-only scope andanthropics/claude-code-actioncould not obtain an OIDC token for posting comments.This change adds a
permissionsblock on theclaudejob withcontents: write,pull-requests: write,issues: write, andid-token: write, matching what the action needs for comment posting and OIDC.Reviewed by Cursor Bugbot for commit 52b5f61. Configure here.
Summary by cubic
Add the missing permissions block to
.github/workflows/claude.ymlsoanthropics/claude-code-action@maincan fetch an OIDC token and post PR/issue comments. Fixes the recurring “Could not fetch an OIDC token” failures.Bug Fixes
permissionsto theclaudejob:id-token: write,contents: write,pull-requests: write,issues: write.Migration
ANTHROPIC_API_KEYrepository secret (Settings → Secrets and variables → Actions).Written for commit 52b5f61. Summary will update on new commits.