Trigger Claude Automatically on Every PR with GitHub Actions
The default Claude GitHub Actions setup responds to @claude mentions. But you can configure it to run automatically on every PR — no manual trigger needed.
After running /install-github-app, edit the workflow file in .github/workflows/ to add an automatic trigger with a prompt parameter:
name: Claude PR Review
on:
pull_request:
types: [opened, synchronize]
jobs:
claude-review:
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Review this pull request. Check for:
- Logic errors or unintended side effects
- Missing error handling
- Security issues (injection, auth bypasses, hardcoded secrets)
- Tests that should exist but don't
Post a summary comment with findings grouped by severity.
Claude reads your CLAUDE.md when it runs in CI, so it already knows your project conventions, coding standards, and patterns to avoid — no need to repeat them in the prompt.
You can also scope reviews to specific file paths so Claude only triggers when relevant code changes:
on:
pull_request:
paths:
- 'src/**'
- 'packages/api/**'
For scheduled audits — weekly security scans, dependency checks — use schedule instead:
on:
schedule:
- cron: '0 9 * * 1' # Every Monday at 9am
Automatic reviews mean every PR gets a second pair of eyes — not just the ones where someone remembered to ask.
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.