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 →
A manual workflow you start from the Actions tab. Claude either summarizes the latest commit or security-reviews it, depending on the option you pick.
workflow_dispatch (manual: summarize-commit or security-review)
How it works
Setup
.github/workflows/claude-code-action-manual-code-analysis.ymlANTHROPIC_API_KEY. The file reads it as secrets.NAME. Do not paste the key into the YAML.Let 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 in GitHub Actions on your Claude Pro or Max plan through an OAuth token from claude setup-token. No API credits.
Set up the "Claude commit analysis on demand (workflow_dispatch)" GitHub workflow from AgentFlows (https://agentflows.sh/flows/claude-code-action-manual-code-analysis) so it runs on my Claude Pro or Max subscription instead of API credits.
Install these agent skills first. Download each SKILL.md from its source (respect its license) into .claude/skills/<name>/SKILL.md, or wherever this agent loads skills from:
- Code review: https://github.com/anthropics/knowledge-work-plugins/blob/main/engineering/skills/code-review/SKILL.md (Apache-2.0), notes at https://agentflows.sh/skills/code-review
Save this file as .github/workflows/claude-code-action-manual-code-analysis.yml:
```yaml
name: Claude Commit Analysis
on:
workflow_dispatch:
inputs:
analysis_type:
description: "Type of analysis to perform"
required: true
type: choice
options:
- summarize-commit
- security-review
default: "summarize-commit"
jobs:
analyze-commit:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 2 # Need at least 2 commits to analyze the latest
- name: Run Claude Analysis
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
BRANCH: ${{ github.ref_name }}
Analyze the latest commit in this repository.
${{ github.event.inputs.analysis_type == 'summarize-commit' && 'Task: Provide a clear, concise summary of what changed in the latest commit. Include the commit message, files changed, and the purpose of the changes.' || '' }}
${{ github.event.inputs.analysis_type == 'security-review' && 'Task: Review the latest commit for potential security vulnerabilities. Check for exposed secrets, insecure coding patterns, dependency vulnerabilities, or any other security concerns. Provide specific recommendations if issues are found.' || '' }}
```
It authenticates with CLAUDE_CODE_OAUTH_TOKEN. Tell me to run `claude setup-token` in my own terminal to create it, then run `gh secret set CLAUDE_CODE_OAUTH_TOKEN` and let me paste it. Never write the token into a file.
It runs on: workflow_dispatch (manual: summarize-commit or security-review). Runs count against my subscription's usage limits, and GitHub Actions minutes still apply.
Show me the diff, then commit on a new branch and open a pull request.The file
Copy the file as-is. The notes beside each block explain it.
.github/workflows/claude-code-action-manual-code-analysis.yml
Name
The name GitHub shows in the Actions tab. The file path is under Where to paste this.
name: Claude Commit AnalysisTrigger
GitHub starts a run when you run it by hand.
on: workflow_dispatch: inputs: analysis_type: description: "Type of analysis to perform" required: true type: choice options: - summarize-commit - security-review default: "summarize-commit"Jobs
Each job is one runner. The steps inside it run top to bottom.
jobs: analyze-commit: runs-on: ubuntu-latestPermissions
This token may read the repo, comment on pull requests and open them, comment on issues and change labels, and request a GitHub OIDC token. Anything not listed is not granted.
permissions: contents: read pull-requests: write issues: write id-token: writeSteps
These steps run in order on that job.
steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 2 # Need at least 2 commits to analyze the latest - name: Run Claude AnalysisAgent
Runs Claude Code with anthropics/claude-code-action@v1. Inputs: anthropic_api_key (the Claude API key secret); prompt (the task).
uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: | REPO: ${{ github.repository }} BRANCH: ${{ github.ref_name }} Analyze the latest commit in this repository. ${{ github.event.inputs.analysis_type == 'summarize-commit' && 'Task: Provide a clear, concise summary of what changed in the latest commit. Include the commit message, files changed, and the purpose of the changes.' || '' }} ${{ github.event.inputs.analysis_type == 'security-review' && 'Task: Review the latest commit for potential security vulnerabilities. Check for exposed secrets, insecure coding patterns, dependency vulnerabilities, or any other security concerns. Provide specific recommendations if issues are found.' || '' }}Keep 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