|
1 | 1 | # Automated code review of pull requests using Claude |
2 | 2 | # |
3 | | -# - PRs opened by members/owners/collaborators are reviewed automatically. |
4 | | -# - For other PRs a member/owner/collaborator can request a review by writing |
5 | | -# a PR comment containing "@claude review". |
| 3 | +# A member/owner/collaborator requests a review by writing a PR comment |
| 4 | +# containing "@claude review". |
6 | 5 | # |
7 | | -# pull_request_target and issue_comment run the workflow file from the base |
8 | | -# branch with access to secrets. The PR code is never checked out or executed. |
| 6 | +# pull_request_target is not used because the Claude GitHub App token exchange |
| 7 | +# rejects OIDC tokens from that event (401 "Invalid OIDC token"). |
| 8 | +# |
| 9 | +# issue_comment runs the workflow file from the default branch with access to |
| 10 | +# secrets. The PR code is never checked out or executed. |
9 | 11 | name: claude-review |
10 | 12 |
|
11 | 13 | on: |
12 | | - pull_request_target: |
13 | | - types: [opened, synchronize, ready_for_review, reopened] |
14 | 14 | issue_comment: |
15 | 15 | types: [created] |
16 | 16 |
|
17 | 17 | jobs: |
18 | 18 | review: |
19 | 19 | if: | |
20 | | - (github.event_name == 'pull_request_target' && |
21 | | - github.event.pull_request.draft == false && |
22 | | - contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.pull_request.author_association)) || |
23 | | - (github.event_name == 'issue_comment' && |
24 | | - github.event.issue.pull_request && |
25 | | - contains(github.event.comment.body, '@claude review') && |
26 | | - contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) |
| 20 | + github.event.issue.pull_request && |
| 21 | + contains(github.event.comment.body, '@claude review') && |
| 22 | + contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) |
27 | 23 |
|
28 | 24 | runs-on: ubuntu-24.04 |
29 | 25 |
|
|
44 | 40 | anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
45 | 41 | prompt: | |
46 | 42 | REPO: ${{ github.repository }} |
47 | | - PR NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }} |
| 43 | + PR NUMBER: ${{ github.event.issue.number }} |
48 | 44 |
|
49 | 45 | Review this pull request. Focus on correctness bugs, potential |
50 | 46 | false positives/false negatives in checkers, performance problems |
|
0 commit comments