Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

review-pr-claude.yml

80 lines3.0 KB

1name: Claude PR Review
2​
3on:
4 issue_comment:
5 types: [created]
6​
7jobs:
8 claude_pr_review:
9 # Only run when a maintainer comments with /review on a PR
10 # Exclude Claude's own comments to prevent recursive triggers
11 if: |
12 github.event.issue.pull_request != null &&
13 github.actor != 'claude[bot]' &&
14 contains(github.event.comment.body, '/review') &&
15 (github.event.comment.user.login == 'kevin-dp' || github.event.comment.user.login == 'KyleAMathews' || github.event.comment.user.login == 'samwillis')
16 runs-on: ubuntu-latest
17 # Prevent multiple concurrent reviews for the same PR
18 concurrency:
19 group: claude-pr-review-${{ github.repository }}-${{ github.event.issue.number }}
20 cancel-in-progress: false
21​
22 permissions:
23 contents: read
24 pull-requests: write
25 issues: write
26 id-token: write
27 actions: read
28​
29 steps:
30 - name: Checkout code
31 uses: actions/checkout@v6.0.1
32 with:
33 fetch-depth: 0
34​
35 - name: Get PR branch
36 id: pr-info
37 env:
38 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 run: |
40 PR_DATA=$(gh pr view ${{ github.event.issue.number }} --json headRefName,baseRefName)
41 echo "head_ref=$(echo $PR_DATA | jq -r '.headRefName')" >> $GITHUB_OUTPUT
42 echo "base_ref=$(echo $PR_DATA | jq -r '.baseRefName')" >> $GITHUB_OUTPUT
43​
44 - name: Checkout PR branch
45 run: git checkout ${{ steps.pr-info.outputs.head_ref }}
46​
47 - name: Run Claude Code (PR review)
48 uses: anthropics/claude-code-action@v1
49 with:
50 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
51 plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
52 plugins: 'pr-review-toolkit'
53 claude_args: |
54 --model claude-opus-4-5
55 --allowedTools Bash,Read,Glob,Grep,Task,Skill
56 prompt: |
57 You are an autonomous PR review agent running in CI for this repository.
58​
59 === Context ===
60 REPO: ${{ github.repository }}
61 PR NUMBER: ${{ github.event.issue.number }}
62 PR TITLE: ${{ github.event.issue.title }}
63 PR URL: ${{ github.event.issue.html_url }}
64 BASE BRANCH: ${{ steps.pr-info.outputs.base_ref }}
65 HEAD BRANCH: ${{ steps.pr-info.outputs.head_ref }}
66​
67 COMMENT (may specify review aspects like "/review tests" or "/review errors code"):
68 ${{ github.event.comment.body }}
69​
70 === Task ===
71 Run the /pr-review-toolkit:review-pr skill to perform a comprehensive multi-agent code review.
72​
73 Parse any review aspects from the comment (e.g., "tests", "errors", "code", "types", "comments", "simplify", "all").
74 Pass these as arguments to the skill. Default to "all" if none specified.
75​
76 After the review completes, post the findings as a comment on PR #${{ github.event.issue.number }} using `gh pr comment`.
77​
78 This is a read-only review. Do NOT make any edits or commits.
79​
80 Proceed now.