1- name : Claude Code Review
2-
1+ name : Claude Auto Review
32on :
4- issue_comment :
5- types : [created ]
3+ pull_request :
4+ types : [opened, synchronize ]
65
76jobs :
8- claude-review :
9- # Only run when @claude is mentioned in a PR comment
10- if : |
11- github.event.issue.pull_request &&
12- contains(github.event.comment.body, '@claude')
13-
7+ review :
148 runs-on : ubuntu-latest
159 permissions :
1610 contents : read
17- pull-requests : read
18- issues : read
11+ pull-requests : write
1912 id-token : write
20-
2113 steps :
22- - name : Checkout repository
23- uses : actions/checkout@v4
14+ - uses : actions/checkout@v5
2415 with :
25- token : ${{ secrets.GITHUB_TOKEN }}
26- repository : ${{ github.event.pull_request.head.repo.full_name }}
27- ref : ${{ github.event.pull_request.head.ref }}
28- fetch-depth : 0
16+ fetch-depth : 1
2917
30- - name : Run Claude Code Review
31- id : claude-review
32- uses : anthropics/claude-code-action@beta
18+ - uses : anthropics/claude-code-action@v1
3319 with :
3420 anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
21+ prompt : |
22+ REPO: ${{ github.repository }}
23+ PR NUMBER: ${{ github.event.pull_request.number }}
3524
36- # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
37- # model: "claude-opus-4-20250514"
38-
39- # Direct prompt for manual review (triggered by @claude mention)
40- direct_prompt : |
41- Please review this pull request and provide feedback on:
25+ Please review this pull request with a focus on:
4226 - Code quality and best practices
4327 - Logical issues
4428 - Potential bugs or issues
4529 - Performance considerations and optimization
4630 - Security concerns
4731 - Test coverage
4832 - Code repeatability
49- - Over engineering
50-
51- Be constructive and helpful in your feedback.
52-
53- # Optional: Customize review based on file types
54- # direct_prompt: |
55- # Review this PR focusing on:
56- # - For TypeScript files: Type safety and proper interface usage
57- # - For API endpoints: Security, input validation, and error handling
58- # - For React components: Performance, accessibility, and best practices
59- # - For tests: Coverage, edge cases, and test quality
33+ - Over engineering
6034
61- # Optional: Different prompts for different authors
62- # direct_prompt: |
63- # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
64- # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
65- # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
35+ Note: The PR branch is already checked out in the current working directory.
6636
67- # Optional: Add specific tools for running tests or linting
68- # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
37+ Use `gh pr comment` for top-level feedback.
38+ Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues.
39+ Only post GitHub comments - don't submit review text as messages.
6940
70- # Optional: Skip review for certain conditions
71- # if: |
72- # !contains(github.event.pull_request.title, '[skip-review]') &&
73- # !contains(github.event.pull_request.title, '[WIP]')
41+ claude_args : |
42+ --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
0 commit comments