-
Notifications
You must be signed in to change notification settings - Fork 22
115 lines (100 loc) · 3.7 KB
/
claude-code-review.yml
File metadata and controls
115 lines (100 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Claude Code Review
on:
# Internal PRs - uses OIDC, comments from claude[bot]
pull_request:
types: [opened, ready_for_review, reopened]
# Fork PRs - uses github_token, comments from github-actions[bot]
pull_request_target:
types: [opened, ready_for_review, reopened]
# Interactive mode: respond to @claude mentions in comments
issue_comment:
types: [created]
env:
REVIEW_PROMPT: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
Review ONLY the changes in this pull request. Focus on:
- Code quality and Java/Spring best practices
- Potential bugs or issues in the changed code
- Security concerns
- Performance considerations
INSTRUCTIONS:
- Use `gh pr diff` to see the changes
- Use `gh pr comment` for top-level feedback
- Use `mcp__github_inline_comment__create_inline_comment` for specific code issues
- Provide feedback in Russian if PR description is in Russian, otherwise in English
OUTPUT FORMAT:
- If no issues found: approve PR with `gh pr review --approve` and comment "LGTM"
- If issues found: list them concisely with inline comments, do NOT approve
- Do NOT include internal checklists or verbose explanations
- Keep it short and actionable
CLAUDE_TOOLS: "--allowedTools \"mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr review:*),Read,Glob,Grep\""
jobs:
# Internal PRs - comments from claude[bot] via OIDC
claude-internal:
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 20
- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: ${{ env.REVIEW_PROMPT }}
claude_args: ${{ env.CLAUDE_TOOLS }}
# Fork PRs - comments from github-actions[bot]
claude-fork:
if: |
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout PR code (fork)
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 20
- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: ${{ env.REVIEW_PROMPT }}
claude_args: ${{ env.CLAUDE_TOOLS }}
# Interactive mode - respond to @claude mentions
claude-interactive:
if: |
github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 20
- name: Run Claude Code
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: ${{ env.CLAUDE_TOOLS }}