|
| 1 | +name: Claude Code Review |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + review-on-comment: |
| 9 | + name: Claude Review (comment trigger) |
| 10 | + if: | |
| 11 | + github.event_name == 'issue_comment' && |
| 12 | + github.event.issue.pull_request && |
| 13 | + contains(github.event.comment.body, '/claude review') |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + pull-requests: write |
| 18 | + issues: write |
| 19 | + id-token: write |
| 20 | + env: |
| 21 | + GH_TOKEN: ${{ github.token }} |
| 22 | + REPO: ${{ github.repository }} |
| 23 | + PR_NUMBER: ${{ github.event.issue.number }} |
| 24 | + steps: |
| 25 | + - name: Get PR head commit |
| 26 | + id: get-pr-head-commit |
| 27 | + run: | |
| 28 | + echo "sha=$(gh pr view $PR_NUMBER --repo $REPO --json headRefOid -q .headRefOid)" | tee -a $GITHUB_OUTPUT |
| 29 | +
|
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v6 |
| 32 | + with: |
| 33 | + fetch-depth: 1 |
| 34 | + ref: ${{ steps.get-pr-head-commit.outputs.sha }} |
| 35 | + |
| 36 | + - name: Run Claude Code Review |
| 37 | + uses: anthropics/claude-code-action@v1 |
| 38 | + with: |
| 39 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 40 | + trigger_phrase: "/claude review" |
| 41 | + show_full_output: true |
| 42 | + claude_args: | |
| 43 | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr review:*)" |
| 44 | + --model "claude-opus-4-6" |
| 45 | + prompt: | |
| 46 | + REPO: ${{ env.REPO }} |
| 47 | + PR NUMBER: ${{ env.PR_NUMBER }} |
| 48 | +
|
| 49 | + You are doing a light code review. Keep it concise and actionable. |
| 50 | +
|
| 51 | + Focus ONLY on: |
| 52 | + - Critical bugs or logic errors |
| 53 | + - Typos in code, comments, or strings |
| 54 | + - Missing or insufficient test coverage for changed code |
| 55 | + - Outdated or inaccurate documentation affected by the changes |
| 56 | +
|
| 57 | + Do NOT comment on: |
| 58 | + - Style preferences or formatting |
| 59 | + - Minor naming suggestions |
| 60 | + - Architectural opinions or refactoring ideas |
| 61 | + - Performance unless there is a clear, measurable issue |
| 62 | +
|
| 63 | + Provide feedback using inline comments for specific code suggestions. |
| 64 | + Use top-level comments for general observations. |
| 65 | +
|
| 66 | + It's perfectly acceptable to not have anything to comment on. |
| 67 | + If you do not have anything to comment on, post "LGTM". |
0 commit comments