|
| 1 | +name: Claude PR Review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, ready_for_review] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: claude-review-${{ github.event.pull_request.number }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + pull-requests: write |
| 14 | + id-token: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + review: |
| 18 | + if: >- |
| 19 | + github.event.pull_request.draft == false && |
| 20 | + github.event.pull_request.head.repo.full_name == github.repository && |
| 21 | + github.actor != 'dependabot[bot]' && |
| 22 | + !contains(github.event.pull_request.labels.*.name, 'skip-claude-review') |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
| 28 | + |
| 29 | + - uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: '3.12' |
| 32 | + |
| 33 | + - name: Install (for type/lint verification) |
| 34 | + run: | |
| 35 | + pip install -e ".[pandas]" |
| 36 | + pip install ruff pyright |
| 37 | +
|
| 38 | + - uses: anthropics/claude-code-action@v1 |
| 39 | + with: |
| 40 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 41 | + prompt: | |
| 42 | + You are an expert reviewer for ${{ github.repository }}, the official SharpAPI Python |
| 43 | + SDK (published to PyPI), reviewing PR #${{ github.event.pull_request.number }}: |
| 44 | + "${{ github.event.pull_request.title }}". |
| 45 | +
|
| 46 | + First read ./REVIEW.md (and ./CLAUDE.md if present) for review rules. Honor them. |
| 47 | +
|
| 48 | + Scope: review ONLY the changes this PR introduces |
| 49 | + (`gh pr diff ${{ github.event.pull_request.number }}`). Read surrounding code for |
| 50 | + context; do NOT comment on pre-existing code the PR does not touch. |
| 51 | +
|
| 52 | + For each genuine problem, post an inline comment on the exact line via the |
| 53 | + mcp__github_inline_comment__create_inline_comment tool (confirmed: true), prefixed: |
| 54 | + [Critical] bug, BACKWARD-INCOMPATIBLE public API change, or a type error |
| 55 | + [Important] a real problem worth fixing before merge |
| 56 | + [Nit] minor/style; skip what `ruff` already enforces |
| 57 | +
|
| 58 | + You MAY run `ruff check` and `pyright` to CONFIRM a lint/type suspicion before |
| 59 | + flagging it. Cite file:line; never speculate — if you cannot verify a concern, omit it. |
| 60 | +
|
| 61 | + Focus: backward compatibility of the public API (PyPI is immutable — flag any breaking |
| 62 | + change to classes/functions/kwargs), pyright type correctness (no `Any` leakage in |
| 63 | + public signatures), correct httpx/pydantic usage, and parity with the documented |
| 64 | + SharpAPI surface. |
| 65 | +
|
| 66 | + Finish with ONE concise summary comment (`gh pr comment`): overall verdict, counts by |
| 67 | + severity, top 1-3 items. Be terse. If clean, say so — do not invent issues. |
| 68 | + claude_args: | |
| 69 | + --model claude-sonnet-4-6 |
| 70 | + --max-turns 15 |
| 71 | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(ruff check:*),Bash(pyright:*),Bash(python -m py_compile:*),Read,Grep" |
| 72 | + --disallowedTools "WebSearch,Write,Edit" |
0 commit comments