Skip to content

Commit 2cb8b34

Browse files
authored
Fix claude pr (#1243)
1 parent c8279d3 commit 2cb8b34

2 files changed

Lines changed: 10 additions & 27 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-

.github/workflows/claude.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,13 @@ jobs:
2323
pull-requests: write
2424
issues: write
2525
id-token: write
26-
actions: read # Required for Claude to read CI results on PRs
27-
steps:
28-
- name: Checkout repository
29-
uses: actions/checkout@v4
30-
with:
31-
fetch-depth: 1
26+
actions: read
3227

28+
steps:
3329
- name: Run Claude Code
3430
id: claude
3531
uses: anthropics/claude-code-action@v1
3632
with:
3733
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38-
39-
# This is an optional setting that allows Claude to read CI results on PRs
4034
additional_permissions: |
4135
actions: read
42-
43-
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44-
# prompt: 'Update the pull request description to include a summary of changes.'
45-
46-
# Optional: Add claude_args to customize behavior and configuration
47-
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48-
# or https://code.claude.com/docs/en/cli-reference for available options
49-
# claude_args: '--allowed-tools Bash(gh pr:*)'
50-

0 commit comments

Comments
 (0)