|
| 1 | +name: Claude |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled] |
| 6 | + issue_comment: |
| 7 | + types: [created] |
| 8 | + pull_request_review_comment: |
| 9 | + types: [created] |
| 10 | + issues: |
| 11 | + types: [opened, assigned] |
| 12 | + pull_request_review: |
| 13 | + types: [submitted] |
| 14 | + |
| 15 | +jobs: |
| 16 | + claude-auto-review: |
| 17 | + if: github.event_name == 'pull_request' && github.event.label.name == 'Review requested' |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + pull-requests: write |
| 22 | + id-token: write |
| 23 | + actions: read # Required for Claude to read CI results on PRs |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 1 |
| 29 | + |
| 30 | + - name: Run Claude Code Review |
| 31 | + id: claude-review |
| 32 | + uses: anthropics/claude-code-action@v1 |
| 33 | + with: |
| 34 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 35 | + prompt: | |
| 36 | + REPO: ${{ github.repository }} |
| 37 | + PR NUMBER: ${{ github.event.pull_request.number }} |
| 38 | +
|
| 39 | + Please review this pull request and provide feedback on: |
| 40 | + - Code quality and best practices |
| 41 | + - Potential bugs or issues |
| 42 | + - Performance considerations |
| 43 | + - Security concerns |
| 44 | +
|
| 45 | + Adhere to the following instructions when adding review comments: |
| 46 | + 1. **Issues Found** |
| 47 | + - List only concrete problems or risks (bugs, security, performance, maintainability). |
| 48 | + - Assign a priority to each: HIGH (must fix), MEDIUM (should fix), LOW (nice to fix). |
| 49 | + - If you're unsure, don't speculate, leave it blank. |
| 50 | + - Consult the `Style-Guide.md` to ensure that the project style is adhered to. |
| 51 | + 2. **Final Recommendation** |
| 52 | + - Choose one: APPROVE or REQUEST CHANGES. |
| 53 | + - Justify in 1–2 sentences based on the issues above. |
| 54 | + - If no issues found, explicitly state 'No issues found' before approving. |
| 55 | + Do not include verbose summaries, comparisons to past reviews, or re-descriptions of the code. Only raise actionable feedback. |
| 56 | +
|
| 57 | + claude_args: '--allowed-tools "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:*)"' |
| 58 | + |
| 59 | + claude-on-demand: |
| 60 | + if: | |
| 61 | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
| 62 | + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
| 63 | + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
| 64 | + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
| 65 | + runs-on: ubuntu-latest |
| 66 | + permissions: |
| 67 | + contents: read |
| 68 | + pull-requests: write |
| 69 | + issues: write |
| 70 | + id-token: write |
| 71 | + actions: read |
| 72 | + steps: |
| 73 | + - name: Checkout repository |
| 74 | + uses: actions/checkout@v4 |
| 75 | + with: |
| 76 | + fetch-depth: 1 |
| 77 | + |
| 78 | + - name: Run Claude Code |
| 79 | + id: claude |
| 80 | + uses: anthropics/claude-code-action@v1 |
| 81 | + with: |
| 82 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 83 | + prompt: | |
| 84 | + REPO: ${{ github.repository }} |
| 85 | +
|
| 86 | + Please respond to the user's request in the context of this repository. |
| 87 | +
|
| 88 | + additional_permissions: | |
| 89 | + actions: read |
0 commit comments