···11+name: Claude Code Review
22+33+on:
44+ pull_request:
55+ types: [opened, synchronize]
66+ # Optional: Only run on specific file changes
77+ # paths:
88+ # - "src/**/*.ts"
99+ # - "src/**/*.tsx"
1010+ # - "src/**/*.js"
1111+ # - "src/**/*.jsx"
1212+1313+jobs:
1414+ claude-review:
1515+ # Optional: Filter by PR author
1616+ # if: |
1717+ # github.event.pull_request.user.login == 'external-contributor' ||
1818+ # github.event.pull_request.user.login == 'new-developer' ||
1919+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
2020+2121+ runs-on: ubuntu-latest
2222+ permissions:
2323+ contents: read
2424+ pull-requests: read
2525+ issues: read
2626+ id-token: write
2727+2828+ steps:
2929+ - name: Checkout repository
3030+ uses: actions/checkout@v4
3131+ with:
3232+ fetch-depth: 1
3333+3434+ - name: Run Claude Code Review
3535+ id: claude-review
3636+ uses: anthropics/claude-code-action@beta
3737+ with:
3838+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3939+4040+ # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
4141+ # model: "claude-opus-4-20250514"
4242+4343+ # Direct prompt for automated review (no @claude mention needed)
4444+ direct_prompt: |
4545+ Please review this pull request and provide feedback on:
4646+ - Code quality and best practices
4747+ - Potential bugs or issues
4848+ - Performance considerations
4949+ - Security concerns
5050+ - Test coverage
5151+5252+ Be constructive and helpful in your feedback.
5353+5454+ # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
5555+ # use_sticky_comment: true
5656+5757+ # Optional: Customize review based on file types
5858+ # direct_prompt: |
5959+ # Review this PR focusing on:
6060+ # - For TypeScript files: Type safety and proper interface usage
6161+ # - For API endpoints: Security, input validation, and error handling
6262+ # - For React components: Performance, accessibility, and best practices
6363+ # - For tests: Coverage, edge cases, and test quality
6464+6565+ # Optional: Different prompts for different authors
6666+ # direct_prompt: |
6767+ # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
6868+ # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
6969+ # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
7070+7171+ # Optional: Add specific tools for running tests or linting
7272+ # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
7373+7474+ # Optional: Skip review for certain conditions
7575+ # if: |
7676+ # !contains(github.event.pull_request.title, '[skip-review]') &&
7777+ # !contains(github.event.pull_request.title, '[WIP]')
7878+
+64
.github/workflows/claude.yml
···11+name: Claude Code
22+33+on:
44+ issue_comment:
55+ types: [created]
66+ pull_request_review_comment:
77+ types: [created]
88+ issues:
99+ types: [opened, assigned]
1010+ pull_request_review:
1111+ types: [submitted]
1212+1313+jobs:
1414+ claude:
1515+ if: |
1616+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
1717+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
1818+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
1919+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020+ runs-on: ubuntu-latest
2121+ permissions:
2222+ contents: read
2323+ pull-requests: read
2424+ issues: read
2525+ id-token: write
2626+ actions: read # Required for Claude to read CI results on PRs
2727+ steps:
2828+ - name: Checkout repository
2929+ uses: actions/checkout@v4
3030+ with:
3131+ fetch-depth: 1
3232+3333+ - name: Run Claude Code
3434+ id: claude
3535+ uses: anthropics/claude-code-action@beta
3636+ with:
3737+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3838+3939+ # This is an optional setting that allows Claude to read CI results on PRs
4040+ additional_permissions: |
4141+ actions: read
4242+4343+ # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
4444+ # model: "claude-opus-4-20250514"
4545+4646+ # Optional: Customize the trigger phrase (default: @claude)
4747+ # trigger_phrase: "/claude"
4848+4949+ # Optional: Trigger when specific user is assigned to an issue
5050+ # assignee_trigger: "claude-bot"
5151+5252+ # Optional: Allow Claude to run specific commands
5353+ # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
5454+5555+ # Optional: Add custom instructions for Claude to customize its behavior for your project
5656+ # custom_instructions: |
5757+ # Follow our coding standards
5858+ # Ensure all new code has tests
5959+ # Use TypeScript for new files
6060+6161+ # Optional: Custom environment variables for Claude
6262+ # claude_env: |
6363+ # NODE_ENV: test
6464+