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

review-pr-claude.yml

83 lines3.2 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32 with:
33 fetch-depth: 0
34 persist-credentials: false
35​
36 - name: Get PR branch
37 id: pr-info
38 env:
39 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 run: |
41 PR_DATA=$(gh pr view ${{ github.event.issue.number }} --json headRefName,baseRefName)
42 echo "head_ref=$(echo $PR_DATA | jq -r '.headRefName')" >> $GITHUB_OUTPUT
43 echo "base_ref=$(echo $PR_DATA | jq -r '.baseRefName')" >> $GITHUB_OUTPUT
44​
45 - name: Checkout PR branch
46 env:
47 HEAD_REF: ${{ steps.pr-info.outputs.head_ref }}
48 run: git checkout "$HEAD_REF"
49​
50 - name: Run Claude Code (PR review)
51 uses: anthropics/claude-code-action@f4fb5c6cdccc1ee7af63692f5d08d56efaa64cc8 # v1.0.121
52 with:
53 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
54 plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
55 plugins: 'pr-review-toolkit'
56 claude_args: |
57 --model claude-opus-4-5
58 --allowedTools Bash,Read,Glob,Grep,Task,Skill
59 prompt: |
60 You are an autonomous PR review agent running in CI for this repository.
61​
62 === Context ===
63 REPO: ${{ github.repository }}
64 PR NUMBER: ${{ github.event.issue.number }}
65 PR TITLE: ${{ github.event.issue.title }}
66 PR URL: ${{ github.event.issue.html_url }}
67 BASE BRANCH: ${{ steps.pr-info.outputs.base_ref }}
68 HEAD BRANCH: ${{ steps.pr-info.outputs.head_ref }}
69​
70 COMMENT (may specify review aspects like "/review tests" or "/review errors code"):
71 ${{ github.event.comment.body }}
72​
73 === Task ===
74 Run the /pr-review-toolkit:review-pr skill to perform a comprehensive multi-agent code review.
75​
76 Parse any review aspects from the comment (e.g., "tests", "errors", "code", "types", "comments", "simplify", "all").
77 Pass these as arguments to the skill. Default to "all" if none specified.
78​
79 After the review completes, post the findings as a comment on PR #${{ github.event.issue.number }} using `gh pr comment`.
80​
81 This is a read-only review. Do NOT make any edits or commits.
82​
83 Proceed now.