Claude auto PR review
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executedJust shippedOur pick for the best security, implementation, and planning skills.Best skills for each job.See the picks →
The standard @claude assistant for issues, PR comments and reviews, but it signs in with GitHub OIDC (Workload Identity Federation) instead of a long-lived ANTHROPIC_API_KEY secret. It needs a one-time federation setup in the Claude Console.
issue_comment / pull_request_review_comment containing @claude (+ issues: opened, assigned; reviews)
How it works
Setup
.github/workflows/claude-code-action-claude-wif.ymlLet your agent do it
Paste it into your coding agent in this repo. It does the setup and asks before anything leaves your machine.
Runs the same job in your agent session, on the plan you are signed in with. No API key, no Action.
Do the job of the "@claude assistant via Workload Identity Federation (no long-lived API key)" workflow from AgentFlows (https://agentflows.sh/flows/claude-code-action-claude-wif) right here, in this session, using the plan I'm signed in with. No API key and no GitHub Action. What it does: The standard @claude assistant for issues, PR comments and reviews, but it signs in with GitHub OIDC (Workload Identity Federation) instead of a long-lived ANTHROPIC_API_KEY secret. It needs a one-time federation setup in the Claude Console. The workflow normally runs on: issue_comment / pull_request_review_comment containing @claude (+ issues: opened, assigned; reviews). Instead, ask me which pull request, issue, or branch to work on, then follow these instructions: ```text The standard @claude assistant for issues, PR comments and reviews, but it signs in with GitHub OIDC (Workload Identity Federation) instead of a long-lived ANTHROPIC_API_KEY secret. It needs a one-time federation setup in the Claude Console. ``` Use the gh CLI for anything on GitHub, and show me what you plan to post or change before you do it.
The file
Copy the file as-is. The notes beside each block explain it.
.github/workflows/claude-code-action-claude-wif.yml
Name
The name GitHub shows in the Actions tab. The file path is under Where to paste this.
name: Claude Code (Workload Identity Federation)# Authenticates to the Claude API by exchanging the workflow's GitHub OIDC# token for a short-lived access token — no ANTHROPIC_API_KEY secret needed.# One-time Console setup (issuer, service account, federation rule):# https://platform.claude.com/docs/en/manage-claude/workload-identity-federation# See also docs/setup.md#workload-identity-federation in this repository.Trigger
GitHub starts a run when someone comments on a pull request review, someone comments on an issue, or an issue is opened or assigned.
on: issue_comment: types: [created] pull_request_review_comment: types: [created] issues: types: [opened, assigned] pull_request_review: types: [submitted]Jobs
Each job is one runner. The steps inside it run top to bottom.
jobs: claude: if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) runs-on: ubuntu-latestPermissions
This token may push commits, comment on pull requests and open them, and comment on issues and change labels. Anything not listed is not granted.
permissions: contents: write pull-requests: write issues: write id-token: write # Required: used to fetch the GitHub OIDC token for the federation exchange actions: read # Required for Claude to read CI results on PRsSteps
These steps run in order on that job.
steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 1 - name: Run Claude Code id: claudeAgent
Runs Claude Code with anthropics/claude-code-action@v1. Inputs: anthropic_federation_rule_id; anthropic_organization_id; anthropic_service_account_id.
uses: anthropics/claude-code-action@v1 with: # These values are identifiers, not secrets — they can live directly # in the workflow file or in repository variables. anthropic_federation_rule_id: fdrl_xxxxxxxxxxxx anthropic_organization_id: 00000000-0000-0000-0000-000000000000 anthropic_service_account_id: svac_xxxxxxxxxxxx # Optional: only needed when the federation rule targets more than # one workspace. # anthropic_workspace_id: wrkspc_xxxxxxxxxxxx # Optional: audience requested on the GitHub OIDC token. Defaults to # https://api.anthropic.com — only set this if your federation rule # expects a different audience. # anthropic_oidc_audience: https://example.com/custom-audienceKeep going
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executed`track_progress: true` posts a checkbox tracking comment (per Solutions Guide).
pull_request: opened, synchronize, ready_for_review, reopened
Est. cost per run~$0.22Checked Oct 16, 2026
Not executedNo `prompt` → the action runs in tag/interactive mode and responds to the comment. `trigger_phrase` default is `@claude` (usage.md).
issue_comment / pull_request_review_comment containing @claude
Est. cost per run~$0.27Checked Oct 16, 2026
Not executed· 1 caveat