diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 31b5b42b8..dfa8116e2 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -30,7 +30,6 @@ concurrency: permissions: contents: read pull-requests: write - id-token: write # OIDC exchange for the Claude GitHub App token jobs: review: @@ -48,6 +47,20 @@ jobs: - uses: anthropics/claude-code-action@1298632ce7736903d02a1435002705aa2a594a6c # v1.0.175 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + # By default the action trades an OIDC token for a Claude GitHub App + # token, and Anthropic's exchange rejects tokens minted under + # `pull_request_target` (anthropics/claude-code-action#713). Passing the + # job token skips that exchange. Under `pull_request_target` the job + # token carries this workflow's declared permissions, so it can post + # comments. Comments appear as github-actions[bot], not claude[bot]. + github_token: ${{ secrets.GITHUB_TOKEN }} + # The action refuses actors without write access, and community + # authors never have it here. This input is the action's escape hatch. + # Its docs restrict it to workflows with very limited permissions, and + # this one qualifies: a job token scoped to `pull-requests: write`, the + # PR head never checked out, and tools limited to reading the diff and + # posting comments. + allowed_non_write_users: '*' prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }}