|
| 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" |
0 commit comments