Skip to content

Commit 61cba69

Browse files
beihailiclaude
andcommitted
chore(ci): add Claude Code Action for auto PR review and @claude Q&A
Adds .github/workflows/claude.yml which triggers on: - pull_request opened/synchronize/reopened -> automatic first-pass review - issue_comment / pull_request_review_comment containing "@claude" -> on-demand reply Safety guards: - Skips Dependabot PRs (dep bumps don't benefit from LLM review) - Skips fork PRs (GITHUB_TOKEN can't write to forks) - Skips bot-authored comments (avoids reply loops) - 15 min job timeout + --max-turns 5 cap on Claude conversation length - Pinned to claude-opus-4-6 Requires ANTHROPIC_API_KEY secret to be configured in repo settings before this workflow starts passing. Without it, runs will fail fast with a missing credential error (not silently). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 560555a commit 61cba69

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/claude.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Claude Code Review
2+
3+
# Triggers:
4+
# - pull_request opened/synchronize/reopened -> automatic first-pass review
5+
# - issue_comment / pull_request_review_comment containing @claude -> on-demand answer
6+
on:
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
issue_comment:
10+
types: [created]
11+
pull_request_review_comment:
12+
types: [created]
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
issues: write
18+
19+
jobs:
20+
claude:
21+
# Skip Dependabot PRs (dep bumps rarely benefit from LLM review and burn API budget).
22+
# Skip fork PRs (GITHUB_TOKEN can't write to forks, so the action would run and silently fail).
23+
# For comment events, skip ones authored by bots to avoid reply-loops with other integrations.
24+
if: >-
25+
!(github.event_name == 'pull_request' && (
26+
github.event.pull_request.user.login == 'dependabot[bot]' ||
27+
github.event.pull_request.head.repo.fork == true
28+
)) &&
29+
!(github.event.comment != null && endsWith(github.event.comment.user.login, '[bot]'))
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 15
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
- uses: anthropics/claude-code-action@v1
37+
with:
38+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
39+
trigger_phrase: '@claude'
40+
# Pin to Opus 4.6; drop --max-turns lower if budget gets tight.
41+
claude_args: --model claude-opus-4-6 --max-turns 5

0 commit comments

Comments
 (0)