Skip to content

Commit 831d757

Browse files
Integrate Claude Code for PR reviews
1 parent 52f540c commit 831d757

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
if: |
16+
!contains(github.event.pull_request.labels.*.name, 'DO NOT REVIEW') &&
17+
!github.event.pull_request.draft
18+
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: read
23+
issues: read
24+
id-token: write
25+
actions: read
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code Review
34+
id: claude-review
35+
uses: anthropics/claude-code-action@beta
36+
with:
37+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38+
39+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
40+
# model: "claude-opus-4-1-20250805"
41+
42+
# Direct prompt for automated review (no @claude mention needed)
43+
direct_prompt: |
44+
Please review this pull request and provide feedback on:
45+
- Code quality and best practices
46+
- Potential bugs or issues
47+
- Performance considerations
48+
- Security concerns
49+
- Test coverage
50+
51+
Provide constructive feedback with specific suggestions for improvement.
52+
Include CLAUDE.md and THREAT_MODEL.md guidelines in your context for every review.
53+
Use inline comments to highlight specific areas of concern.
54+
55+
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
56+
use_sticky_comment: true
57+
58+
# Optional: Customize review based on file types
59+
# direct_prompt: |
60+
# Review this PR focusing on:
61+
# - For TypeScript files: Type safety and proper interface usage
62+
# - For API endpoints: Security, input validation, and error handling
63+
# - For React components: Performance, accessibility, and best practices
64+
# - For tests: Coverage, edge cases, and test quality
65+
66+
# Optional: Different prompts for different authors
67+
# direct_prompt: |
68+
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
69+
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
70+
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
71+
72+
# Optional: Add specific tools for running tests or linting
73+
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
74+
75+
# Optional: Skip review for certain conditions
76+
# if: |
77+
# !contains(github.event.pull_request.title, '[skip-review]') &&
78+
# !contains(github.event.pull_request.title, '[WIP]')

0 commit comments

Comments
 (0)