Skip to content

Commit 159cd45

Browse files
graycreateclaude
andcommitted
feat: add manual triggering options for Claude code review
- Modified claude-code-review.yml to support label-based and manual triggering - Added workflow_dispatch for manual PR reviews - Automatic reviews now only for first-time contributors or when 'claude-review' label is added - Created dedicated manual review workflow with customizable review types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 8a5b367 commit 159cd45

File tree

2 files changed

+65
-12
lines changed

2 files changed

+65
-12
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Claude Code Review (Manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pr_number:
7+
description: 'Pull Request number to review'
8+
required: true
9+
type: number
10+
review_type:
11+
description: 'Type of review to perform'
12+
required: false
13+
default: 'standard'
14+
type: choice
15+
options:
16+
- standard
17+
- security-focused
18+
- performance-focused
19+
- quick-check
20+
21+
jobs:
22+
claude-review:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
issues: read
28+
id-token: write
29+
30+
steps:
31+
- name: Checkout PR
32+
uses: actions/checkout@v4
33+
with:
34+
ref: refs/pull/${{ inputs.pr_number }}/merge
35+
fetch-depth: 0
36+
37+
- name: Run Claude Code Review
38+
uses: anthropics/claude-code-action@beta
39+
with:
40+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
41+
42+
# Customize prompt based on review type
43+
direct_prompt: |
44+
Please review PR #${{ inputs.pr_number }} with focus on:
45+
${{ inputs.review_type == 'security-focused' && '- Security vulnerabilities and best practices' ||
46+
inputs.review_type == 'performance-focused' && '- Performance optimizations and bottlenecks' ||
47+
inputs.review_type == 'quick-check' && '- Critical issues and bugs only (brief review)' ||
48+
'- Code quality, bugs, performance, security, and test coverage' }}
49+
50+
Be constructive and helpful in your feedback.

.github/workflows/claude-code-review.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@ name: Claude Code Review
22

33
on:
44
pull_request:
5-
types: [opened, synchronize]
6-
# Optional: Only run on specific file changes
7-
# paths:
8-
# - "src/**/*.ts"
9-
# - "src/**/*.tsx"
10-
# - "src/**/*.js"
11-
# - "src/**/*.jsx"
5+
types: [opened, synchronize, labeled]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: 'Pull Request number to review (leave empty for current PR)'
10+
required: false
11+
type: string
1212

1313
jobs:
1414
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
15+
# Only run if:
16+
# 1. Manually triggered via workflow_dispatch
17+
# 2. PR has the 'claude-review' label
18+
# 3. PR is from a first-time contributor (automatic)
19+
if: |
20+
github.event_name == 'workflow_dispatch' ||
21+
contains(github.event.pull_request.labels.*.name, 'claude-review') ||
22+
github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
2023
2124
runs-on: ubuntu-latest
2225
permissions:

0 commit comments

Comments
 (0)