Skip to content

Commit 7ccab02

Browse files
authored
Merge pull request #10531 from Roasbeef/claude-fix
workflows: fix Claude workflows for fork PRs and external contributors
2 parents 19b2ad7 + a77b9d9 commit 7ccab02

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.github/workflows/claude.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ jobs:
3030
with:
3131
fetch-depth: 1
3232

33+
- name: Checkout PR branch (handles fork PRs)
34+
if: github.event.issue.pull_request || github.event_name == 'pull_request_review_comment' || github.event_name == 'pull_request_review'
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
run: |
38+
if [ "${{ github.event_name }}" = "issue_comment" ]; then
39+
PR_NUMBER=${{ github.event.issue.number }}
40+
else
41+
PR_NUMBER=${{ github.event.pull_request.number }}
42+
fi
43+
gh pr checkout "$PR_NUMBER"
44+
3345
- name: Run Claude Code
3446
id: claude
3547
uses: anthropics/claude-code-action@v1

.github/workflows/pr-severity.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ jobs:
3737
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3838
github_token: ${{ secrets.PR_SEVERITY_BOT_TOKEN }}
3939

40+
# Allow any user since this workflow only reads PR metadata via API
41+
# and doesn't execute any code from the PR. Tool permissions are
42+
# restricted to gh pr commands only.
43+
allowed_non_write_users: "*"
44+
4045
# Allow Claude to manage labels and post comments.
4146
# Keep permissions minimal to limit prompt injection risk.
4247
claude_args: --allowedTools "Bash(gh pr view:*)" "Bash(gh pr edit:*)" "Bash(gh pr comment:*)"

0 commit comments

Comments
 (0)