Skip to content

Commit 1669160

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 69105cb commit 1669160

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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-node@v4
30+
with:
31+
node-version: '22'
32+
33+
- run: npm ci
34+
35+
- uses: anthropics/claude-code-action@v1
36+
with:
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38+
prompt: |
39+
You are an expert reviewer for ${{ github.repository }}, the official SharpAPI
40+
TypeScript/JS SDK (published to npm), reviewing PR
41+
#${{ github.event.pull_request.number }}: "${{ github.event.pull_request.title }}".
42+
43+
First read ./REVIEW.md (and ./CLAUDE.md if present) for review rules. Honor them.
44+
45+
Scope: review ONLY the changes this PR introduces
46+
(`gh pr diff ${{ github.event.pull_request.number }}`). Read surrounding code for
47+
context; do NOT comment on pre-existing code the PR does not touch.
48+
49+
For each genuine problem, post an inline comment on the exact line via the
50+
mcp__github_inline_comment__create_inline_comment tool (confirmed: true), prefixed:
51+
[Critical] bug, BACKWARD-INCOMPATIBLE public API change, or a type-soundness hole
52+
[Important] a real problem worth fixing before merge
53+
[Nit] minor/style; skip what ESLint already enforces
54+
55+
You MAY run `npx tsc --noEmit` and `npm run lint` to CONFIRM a type/lint suspicion
56+
before flagging it. Cite file:line; never speculate — if you cannot verify, omit it.
57+
58+
Focus: backward compatibility of the public API (npm is immutable — flag any breaking
59+
change to exported types/functions/options), TypeScript type soundness (no `any`
60+
leakage in public types, correct generics), ESM correctness (import/export shape,
61+
`package.json` exports map), and parity with the documented SharpAPI surface.
62+
63+
Finish with ONE concise summary comment (`gh pr comment`): overall verdict, counts by
64+
severity, top 1-3 items. Be terse. If clean, say so — do not invent issues.
65+
claude_args: |
66+
--model claude-sonnet-4-6
67+
--max-turns 15
68+
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(npx tsc --noEmit:*),Bash(npm run lint:*),Read,Grep"
69+
--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-ts (official TypeScript 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-soundness hole.
7+
- **[Important]** — a real problem to fix before merge.
8+
- **[Nit]** — minor/style. Skip what ESLint already enforces.
9+
10+
## Always check
11+
- **Backward compatibility** — exported types/functions/options are a published contract (npm is immutable). Flag any breaking change.
12+
- **Type soundness** — passes `tsc --noEmit`; no `any` leakage in public types; correct generics.
13+
- **ESM correctness** — import/export shape, `package.json` exports map, no CJS/ESM hazards.
14+
- **API parity** — the SDK matches the documented SharpAPI surface.
15+
16+
## Don't
17+
- Don't flag pre-existing code this PR didn't touch.
18+
- You MAY run `npx tsc --noEmit` / `npm run lint` to confirm a concern; otherwise don't speculate — cite `file:line` or omit. "LGTM" is valid.

0 commit comments

Comments
 (0)