Skip to content

Commit 027854e

Browse files
genednaclaude
andcommitted
fix: extend PR branch setup to all PR event types in claude review
The Setup PR Branch workaround only ran for issue_comment events, causing claude-code-action to fail with "couldn't find remote ref pull/N/head" on pull_request_target and other PR events. Extend the condition to cover all PR-related event types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Quanyi Ma <eli@patch.sh>
1 parent 800f1d6 commit 027854e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/claude-review.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ jobs:
8989
# We create the branch from the current HEAD (which is the secure, verified SHA checked out above)
9090
# This avoids fetching mutable refs from the network, addressing the "Untrusted Checkout" vulnerability
9191
- name: Setup PR Branch
92-
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
92+
if: |
93+
(github.event_name == 'issue_comment' && github.event.issue.pull_request) ||
94+
github.event_name == 'pull_request_target' ||
95+
github.event_name == 'pull_request_review_comment' ||
96+
github.event_name == 'pull_request_review'
9397
env:
94-
PR_NUMBER: ${{ github.event.issue.number }}
98+
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
9599
run: |
96100
echo "Setting up local PR branch pr-$PR_NUMBER..."
97101
git checkout -b pr-$PR_NUMBER

0 commit comments

Comments
 (0)