|
1 | 1 | name: Claude Code |
2 | 2 |
|
3 | 3 | on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
4 | 6 | issue_comment: |
5 | 7 | types: [created] |
6 | 8 | pull_request_review_comment: |
|
9 | 11 | types: [opened, assigned] |
10 | 12 | pull_request_review: |
11 | 13 | types: [submitted] |
12 | | - pull_request: |
13 | | - types: [opened, synchronize, ready_for_review, reopened] |
14 | 14 |
|
15 | 15 | jobs: |
16 | | - claude: |
17 | | - if: | |
18 | | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
19 | | - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
20 | | - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
21 | | - (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
| 16 | + automated-review: |
| 17 | + if: github.event_name == 'pull_request' && github.event.pull_request.user.type != 'Bot' |
22 | 18 | runs-on: ubuntu-latest |
23 | 19 | permissions: |
24 | 20 | contents: read |
25 | | - pull-requests: write |
26 | | - issues: write |
| 21 | + pull-requests: read |
| 22 | + issues: read |
27 | 23 | id-token: write |
28 | | - actions: read |
29 | 24 | steps: |
30 | 25 | - name: Checkout repository |
31 | | - uses: actions/checkout@v4 |
| 26 | + uses: actions/checkout@v6 |
32 | 27 | with: |
33 | 28 | fetch-depth: 1 |
34 | 29 |
|
35 | | - - name: Run Claude Code |
36 | | - id: claude |
37 | | - uses: anthropics/claude-code-action@v1 |
| 30 | + - name: Run Automated AI Review |
| 31 | + id: automated-review |
| 32 | + uses: anthropics/claude-code-action@beta |
38 | 33 | with: |
39 | 34 | anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
40 | | - additional_permissions: | |
41 | | - actions: read |
| 35 | + direct_prompt: | |
| 36 | + ## Review this pull request |
| 37 | +
|
| 38 | + You are reviewing a PR for **codegraph** — a local code dependency graph CLI that parses |
| 39 | + codebases with tree-sitter (WASM), builds function-level dependency graphs in SQLite, and |
| 40 | + supports semantic search with local embeddings. |
| 41 | +
|
| 42 | + ### Phase 1: Root Cause Analysis |
| 43 | + Before reviewing code, determine: |
| 44 | + - **What problem is this PR solving?** Is it fixing a real issue or hiding symptoms? |
| 45 | + - **Is the approach justified?** Are configuration/linting changes relaxing rules to silence errors? |
| 46 | + - ⚠️ REJECT if changes silence warnings without fixing underlying issues |
| 47 | + - ⚠️ REJECT if test expectations are lowered to make tests pass |
| 48 | + - If you cannot determine the root cause, REQUEST MORE INFORMATION |
| 49 | +
|
| 50 | + ### Phase 2: Configuration Change Detection (HIGH SCRUTINY) |
| 51 | + Check for HIGH-RISK changes: |
| 52 | + - Biome/linting rules disabled or relaxed |
| 53 | + - Test timeouts increased or coverage thresholds lowered |
| 54 | + - Build configuration or module resolution modified |
| 55 | + - TypeScript strict mode flags disabled |
| 56 | + - **If >3 rules are relaxed → REQUEST justification for each** |
| 57 | +
|
| 58 | + ### Phase 3: Test Integrity |
| 59 | + Watch for RED FLAGS: |
| 60 | + - Removed or weakened assertions |
| 61 | + - Tests made less strict (conditional assertions, skipped validation) |
| 62 | + - Test files modified alongside the code they test without clear reason |
| 63 | + - `eslint-disable` or workaround comments without justification |
| 64 | + - Large PRs (>20 files) mixing unrelated concerns |
42 | 65 |
|
43 | | - review: |
44 | | - if: github.event_name == 'pull_request' |
| 66 | + ### Phase 4: Code Quality |
| 67 | + Only after passing Phases 1-3: |
| 68 | + - Code quality and best practices |
| 69 | + - Potential bugs (especially in tree-sitter extractors, import resolution, SQLite operations) |
| 70 | + - Security concerns (command injection in CLI, SQL injection in queries) |
| 71 | + - Performance (unnecessary full rebuilds, missing incremental hash checks) |
| 72 | + - Test coverage for new functionality |
| 73 | +
|
| 74 | + ### Rating (STRICT — default to 2-3 stars) |
| 75 | + - ⭐ Critical issues, REJECT |
| 76 | + - ⭐⭐ Significant concerns, REQUEST CHANGES |
| 77 | + - ⭐⭐⭐ Acceptable with minor concerns, APPROVE with conditions |
| 78 | + - ⭐⭐⭐⭐ Good quality, well-tested, APPROVE |
| 79 | + - ⭐⭐⭐⭐⭐ Exceptional (< 5% of PRs) |
| 80 | +
|
| 81 | + ### Final Assessment (MANDATORY) |
| 82 | + ``` |
| 83 | + ## Root Cause Analysis |
| 84 | + **Problem Being Solved**: [...] |
| 85 | + **Why This Approach**: [...] |
| 86 | + **Risk Assessment**: [...] |
| 87 | +
|
| 88 | + ## Critical Concerns (if any) |
| 89 | + [...] |
| 90 | +
|
| 91 | + ## Final Recommendation |
| 92 | + - Rating: ⭐⭐☆☆☆ (X/5) |
| 93 | + - Action: [REJECT | REQUEST CHANGES | APPROVE WITH CONDITIONS | APPROVE] |
| 94 | + - Reasoning: [...] |
| 95 | + ``` |
| 96 | +
|
| 97 | + Be skeptical but fair. Reference exact line numbers. Explain WHY something is problematic. |
| 98 | + NEVER default to approval — require the PR to prove its value. |
| 99 | +
|
| 100 | + interactive-claude: |
| 101 | + if: | |
| 102 | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
| 103 | + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
| 104 | + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
| 105 | + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
45 | 106 | runs-on: ubuntu-latest |
46 | 107 | permissions: |
47 | 108 | contents: read |
48 | | - pull-requests: write |
49 | | - issues: write |
| 109 | + pull-requests: read |
| 110 | + issues: read |
50 | 111 | id-token: write |
| 112 | + actions: read |
51 | 113 | steps: |
52 | 114 | - name: Checkout repository |
53 | | - uses: actions/checkout@v4 |
| 115 | + uses: actions/checkout@v6 |
54 | 116 | with: |
55 | 117 | fetch-depth: 1 |
56 | 118 |
|
57 | | - - name: Run Claude Code Review |
58 | | - id: claude-review |
59 | | - uses: anthropics/claude-code-action@v1 |
| 119 | + - name: Run Interactive AI Assistant |
| 120 | + id: interactive-claude |
| 121 | + uses: anthropics/claude-code-action@beta |
60 | 122 | with: |
61 | 123 | anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
62 | | - plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' |
63 | | - plugins: 'code-review@claude-code-plugins' |
64 | | - prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' |
65 | | - allowed_tools: 'Bash(gh pr *),Bash(gh api *),Bash(git diff *),Bash(git log *),Read,Glob,Grep' |
| 124 | + additional_permissions: | |
| 125 | + actions: read |
0 commit comments