|
| 1 | +name: Claude Code Review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened] |
| 6 | + |
| 7 | +jobs: |
| 8 | + claude-review: |
| 9 | + name: Claude Code Review |
| 10 | + |
| 11 | + runs-on: ubuntu-latest |
| 12 | + permissions: |
| 13 | + contents: read |
| 14 | + pull-requests: read |
| 15 | + issues: read |
| 16 | + id-token: write |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 1 |
| 23 | + |
| 24 | + - name: Run Claude Code Review |
| 25 | + id: claude-review |
| 26 | + uses: anthropics/claude-code-action@v1 |
| 27 | + with: |
| 28 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 29 | + prompt: | |
| 30 | + REPO: ${{ github.repository }} |
| 31 | + PR NUMBER: ${{ github.event.pull_request.number }} |
| 32 | +
|
| 33 | + Please review this pull request and provide feedback on: |
| 34 | + - Potential bugs or issues |
| 35 | + - Performance considerations |
| 36 | + - Important security concerns |
| 37 | +
|
| 38 | + Be constructive and helpful in your feedback and be **very conscise**. |
| 39 | + Skip general recommendations, skip summarizing the changes, and don't make any recommendations on code style. |
| 40 | + Also skip any summarization about why the PR was done well, focus only on the code changes and the potential issues. |
| 41 | + Don't output final summaries, or final lists of action items. |
| 42 | + Reduce false positives—try to validate if the issue is really a valid problem in the changes. |
| 43 | +
|
| 44 | + When you find a *specific issue* in the code (bug, performance concern, security risk, etc.), |
| 45 | + leave an **inline comment** on that exact file and line. |
| 46 | + If no issues are found, do not post anything. |
| 47 | +
|
| 48 | + To comment inline, use this format exactly: |
| 49 | +
|
| 50 | + ```bash |
| 51 | + gh api \ |
| 52 | + --method POST \ |
| 53 | + -H "Accept: application/vnd.github+json" \ |
| 54 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 55 | + /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments \ |
| 56 | + -f body='${BODY}' \ |
| 57 | + -f commit_id="${{ github.event.pull_request.head.sha }}" \ |
| 58 | + -f path='${PATH}' \ |
| 59 | + -F line=${LINE} \ |
| 60 | + -f side='RIGHT' |
| 61 | + ``` |
| 62 | +
|
| 63 | + claude_args: '--allowed-tools "Bash(gh api:*), Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' |
0 commit comments