File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,16 +19,30 @@ jobs:
1919 (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020 runs-on : ubuntu-latest
2121 permissions :
22- contents : read
23- pull-requests : read
22+ contents : write
23+ pull-requests : write
2424 issues : read
2525 id-token : write
2626 actions : read # Required for Claude to read CI results on PRs
2727 steps :
28+ - name : Get PR head ref
29+ id : pr-ref
30+ env :
31+ GH_TOKEN : ${{ github.token }}
32+ run : |
33+ # For issue_comment events, we need to fetch the PR info
34+ if [ "${{ github.event_name }}" = "issue_comment" ]; then
35+ PR_REF=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} --jq '.head.ref')
36+ echo "ref=$PR_REF" >> $GITHUB_OUTPUT
37+ else
38+ echo "ref=${{ github.event.pull_request.head.ref || github.head_ref }}" >> $GITHUB_OUTPUT
39+ fi
40+
2841 - name : Checkout repository
2942 uses : actions/checkout@v4
3043 with :
31- fetch-depth : 1
44+ fetch-depth : 0
45+ ref : ${{ steps.pr-ref.outputs.ref }}
3246
3347 - name : Run Claude Code
3448 id : claude
You can’t perform that action at this time.
0 commit comments