How to Set Up Claude Code Review in GitHub Actions (5 Minutes)
Want Claude to review every pull request in your repo automatically? With Cody it takes about five minutes and requires no hosting — just a GitHub Actions workflow and your Anthropic API key. Here's the full setup.
Step 1 — Add your Anthropic API key
Create an API key at platform.claude.com, then add it to your repo as a secret:
Settings → Secrets and variables → Actions → New repository secret, named ANTHROPIC_API_KEY.
GITHUB_TOKEN doesn't need to be added — GitHub provides it to workflows automatically.
Step 2 — Add the workflow file
Create .github/workflows/code_review.yml in your repo:
name: Automated Code Review by Cody
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
code_review:
if: ${{ github.event.pull_request.head.repo.fork == false }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Clone cody-code-reviewer repository
run: |
git clone https://github.com/codylabs/cody-code-reviewer.git
cd cody-code-reviewer
# Pin to a specific release commit to ensure stability https://github.com/codylabs/cody-code-reviewer/releases/tag/v1.3.0
git checkout 42800f56034b775ea5dedfcdf44882213e17a70c
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Code Review Model
run: |
python src/review_pull_request.py ${{ github.event.pull_request.number }} ${{ github.repository }} > ${{ github.workspace }}/output.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MODEL: "claude-opus-4-8"
- name: Comment on Pull Request
run: |
python src/comment_on_pr.py ${{ github.event.pull_request.number }} "${{ secrets.GITHUB_TOKEN }}" ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The important line is MODEL: "claude-opus-4-8" — any claude-* model name routes the review to Anthropic. Prefer a cheaper review? Use claude-sonnet-5 or claude-haiku-4-5 instead.
Step 3 — Open a pull request
That's it. On your next pull request, Cody fetches the diff, asks Claude to review it like a senior engineer, and posts the review as a PR comment — a summary of the change followed by focused feedback on functionality and security, with code suggestions in markdown.
Troubleshooting
- No comment appears? Check the Actions run logs, and make sure the workflow has
pull-requests: writepermission (included in the yaml above). - Authentication error? Confirm the
ANTHROPIC_API_KEYsecret name matches exactly and the key is active. - Want reviews on GitLab or Azure DevOps? That's available in Cody Pro.
More details in the Quick Start Documentation.
Keywords: Claude code review GitHub Actions, Anthropic API GitHub Actions, automated PR review Claude, Claude Opus 4.8 tutorial, AI code review setup, GitHub Actions AI review workflow, CodyLabs, 2026