Skip to content

Commit e3f8a2b

Browse files
paperclip-resolver[bot]claude
andcommitted
ci: add Claude Code PR reviewer (comment-only)
Adds .github/workflows/claude-review.yml + REVIEW.md. Auto-reviews PRs via anthropics/claude-code-action@v1 using the CLAUDE_CODE_OAUTH_TOKEN secret. Comment-only (inline + summary), non-blocking; skips drafts/forks/dependabot and the skip-claude-review label. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent deccf47 commit e3f8a2b

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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"

REVIEW.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Review rules — sharpapi-python (official Python SDK)
2+
3+
Guidance for the automated Claude PR reviewer (`.github/workflows/claude-review.yml`).
4+
5+
## Severity
6+
- **[Critical]** — bug, a backward-incompatible change to the public API, or a type error.
7+
- **[Important]** — a real problem to fix before merge.
8+
- **[Nit]** — minor/style. Skip what `ruff` already enforces.
9+
10+
## Always check
11+
- **Backward compatibility** — public classes/functions/kwargs are a published contract (PyPI is immutable). Flag any breaking change.
12+
- **Types** — passes `pyright`; accurate annotations; no `Any` leakage in public signatures.
13+
- **httpx / pydantic** — correct async/sync usage, error handling, model validation.
14+
- **API parity** — the SDK matches the documented SharpAPI surface (endpoints, params, response models).
15+
16+
## Don't
17+
- Don't flag pre-existing code this PR didn't touch.
18+
- You MAY run `ruff check` / `pyright` to confirm a concern; otherwise don't speculate — cite `file:line` or omit. "LGTM" is valid.

0 commit comments

Comments
 (0)