|
1 |
| -name: Claude Code Review |
| 1 | +name: Claude Review |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | pull_request:
|
5 | 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" |
| 6 | + issue_comment: |
| 7 | + types: [created] |
12 | 8 |
|
13 | 9 | jobs:
|
14 | 10 | 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' |
| 11 | + # ✅ 実行される場合: |
| 12 | + # - PR 作成時(自動レビュー) |
| 13 | + # - PR 更新時(自動レビュー) |
| 14 | + # - Issueコメントで「@claude これを見て」 |
| 15 | + # - PR のコメントで「@claude レビューして」 |
20 | 16 | #
|
21 |
| - # 現時点では Org 内の MEMBER と OWNER のみが使用可能 |
| 17 | + # ❌ 実行されない場合: |
| 18 | + # - Issueコメントでも @claude がない場合 |
| 19 | + # - PR のコメントでも @claude がない場合 |
22 | 20 | if: |
|
23 |
| - (github.event_name == 'pull_request' && |
24 |
| - contains(fromJSON('["MEMBER", "OWNER"]'), github.event.pull_request.author_association)) || |
| 21 | + (github.event_name == 'pull_request') || |
25 | 22 | (github.event_name == 'issue_comment' &&
|
26 |
| - github.event.issue.pull_request && |
27 |
| - contains(github.event.comment.body, '@claude') && |
28 |
| - contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association)) |
29 |
| - |
| 23 | + contains(github.event.comment.body, '@claude')) |
| 24 | + |
30 | 25 | runs-on: ubuntu-latest
|
31 |
| - |
32 |
| - # 最小限の権限のみ付与 |
| 26 | + |
| 27 | + # 推奨: 最小限の権限のみ付与 |
33 | 28 | permissions:
|
34 |
| - contents: read # リポジトリ内容の読込/書込 |
35 |
| - pull-requests: read # PRのコメントの読込/書込 |
36 |
| - issues: read # Issueのコメントの読込/書込 |
37 |
| - id-token: write # 実行時に適切な権限を取得 (ココがwriteの時、上記はreadで良い) |
| 29 | + contents: read # Repository 内の権限 |
| 30 | + pull-requests: read # PR 内コメントの権限 |
| 31 | + issues: read # Issueコメントの権限 |
| 32 | + actions: read # Actionsログへの権限 |
| 33 | + id-token: write # 実行時に適切な権限を取得 |
38 | 34 |
|
39 | 35 | steps:
|
40 |
| - - name: Checkout repository |
| 36 | + - name: Checkout |
41 | 37 | uses: actions/checkout@v4
|
42 | 38 | with:
|
43 |
| - fetch-depth: 1 |
| 39 | + fetch-depth: 2 |
44 | 40 |
|
45 |
| - - name: Run Claude Code Review |
46 |
| - id: claude-review |
47 |
| - uses: anthropics/claude-code-action@beta |
| 41 | + - name: Claude Review |
| 42 | + uses: yasslab/claude_review_action@main |
48 | 43 | with:
|
49 | 44 | claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
50 |
| - |
51 |
| - # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) |
52 |
| - model: "claude-opus-4-20250514" |
53 |
| - |
54 |
| - # Direct prompt for automated review (no @claude mention needed) |
55 |
| - direct_prompt: | |
56 |
| - Please review this pull request and provide feedback on: |
57 |
| - - Code quality and best practices |
58 |
| - - Potential bugs or issues |
59 |
| - - Performance considerations |
60 |
| - - Security concerns |
61 |
| - - Test coverage |
62 |
| - |
63 |
| - Be constructive and helpful in your feedback. |
64 |
| - Always respond in Japanese, even if given instructions are in English. |
65 |
| - Use Japanese for all outputs, explanations, and comments in code |
66 |
| -
|
67 |
| - For each heading use this HTML style that users can see your summary at first and check details when clicking: |
68 |
| - <details> |
69 |
| - <summary><strong>[YOUR_HEADING]</strong></summary> |
70 |
| - [YOUR_FEEDBACKS] |
71 |
| - </details> |
72 |
| - Not that inside <details> tags you should write in HTML, not Markdown. |
73 |
| -
|
74 |
| - # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR |
75 |
| - # use_sticky_comment: true |
76 |
| - |
77 |
| - # Optional: Customize review based on file types |
78 |
| - # direct_prompt: | |
79 |
| - # Review this PR focusing on: |
80 |
| - # - For TypeScript files: Type safety and proper interface usage |
81 |
| - # - For API endpoints: Security, input validation, and error handling |
82 |
| - # - For React components: Performance, accessibility, and best practices |
83 |
| - # - For tests: Coverage, edge cases, and test quality |
84 |
| - |
85 |
| - # Optional: Different prompts for different authors |
86 |
| - # direct_prompt: | |
87 |
| - # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && |
88 |
| - # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || |
89 |
| - # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} |
90 |
| - |
91 |
| - # Optional: Add specific tools for running tests or linting |
92 |
| - # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)" |
93 |
| - |
94 |
| - # Optional: Skip review for certain conditions |
95 |
| - # if: | |
96 |
| - # !contains(github.event.pull_request.title, '[skip-review]') && |
97 |
| - # !contains(github.event.pull_request.title, '[WIP]') |
98 |
| - |
0 commit comments