Skip to content

Commit 8975f88

Browse files
authored
Modify Claude Code Review workflow for fork PRs
Updated workflow to use pull_request_target for fork PRs and added comments for clarity.
1 parent c8279d3 commit 8975f88

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Claude Code Review
22

33
on:
4-
pull_request:
4+
# Use pull_request_target so this works for fork PRs and can mint an OIDC token.
5+
# IMPORTANT: do NOT checkout or run fork code in this workflow.
6+
pull_request_target:
57
types: [opened, synchronize, ready_for_review, reopened]
68
# Optional: Only run on specific file changes
79
# paths:
@@ -12,11 +14,10 @@ on:
1214

1315
jobs:
1416
claude-review:
15-
# Optional: Filter by PR author
17+
# Optional: Filter by PR author / association
1618
# 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'
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' ||
20+
# github.event.pull_request.author_association == 'CONTRIBUTOR'
2021

2122
runs-on: ubuntu-latest
2223
permissions:
@@ -26,10 +27,8 @@ jobs:
2627
id-token: write
2728

2829
steps:
29-
- name: Checkout repository
30-
uses: actions/checkout@v4
31-
with:
32-
fetch-depth: 1
30+
# NOTE: No checkout step on purpose.
31+
# With pull_request_target, checking out PR code from forks can expose secrets.
3332

3433
- name: Run Claude Code Review
3534
id: claude-review
@@ -41,4 +40,3 @@ jobs:
4140
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
4241
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4342
# or https://code.claude.com/docs/en/cli-reference for available options
44-

0 commit comments

Comments
 (0)