|
| 1 | +name: Code Review from AI Agent |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + issue_comment: |
| 7 | + types: [created] |
| 8 | + |
| 9 | +jobs: |
| 10 | + claude-review: |
| 11 | + # Run on PR events, or on issue comments that are on PRs and mention @claude |
| 12 | + if: | |
| 13 | + github.event_name == 'pull_request' || |
| 14 | + (github.event_name == 'issue_comment' && |
| 15 | + github.event.issue.pull_request && |
| 16 | + contains(github.event.comment.body, '@claude')) |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + pull-requests: write |
| 21 | + issues: write |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Run Claude Code Review |
| 29 | + uses: anthropics/claude-code-action@v1 |
| 30 | + with: |
| 31 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 32 | + # Direct prompt for initial PR review |
| 33 | + direct_prompt: | |
| 34 | + Review this pull request for a Zig SCALE codec library. |
| 35 | +
|
| 36 | + Focus on: |
| 37 | + 1. **Correctness**: Does the code correctly implement SCALE encoding/decoding? |
| 38 | + 2. **Zig idioms**: Does the code follow Zig best practices? |
| 39 | + 3. **Memory safety**: Are there any memory leaks or unsafe patterns? |
| 40 | + 4. **Error handling**: Are errors properly propagated and handled? |
| 41 | + 5. **Test coverage**: Are new features adequately tested? |
| 42 | + 6. **Documentation**: Are public APIs documented? |
| 43 | +
|
| 44 | + For context, this is a SCALE codec implementation aligned with Rust's parity-scale-codec. |
| 45 | + Key types: Compact(T), Result(T, E), Option(T), tagged unions with scale_indices. |
| 46 | +
|
| 47 | + # Timeout for the review (5 minutes) |
| 48 | + timeout_minutes: 10 |
| 49 | + claude_args: | |
| 50 | + --model opus |
0 commit comments