File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,10 +27,44 @@ jobs:
2727 id-token : write
2828 actions : read
2929 steps :
30+ - name : Get PR details
31+ if : |
32+ (github.event_name == 'issue_comment' && github.event.issue.pull_request) ||
33+ github.event_name == 'pull_request_review_comment' ||
34+ github.event_name == 'pull_request_review'
35+ id : pr
36+ uses : actions/github-script@v7
37+ with :
38+ script : |
39+ let prNumber;
40+ if (context.eventName === 'issue_comment') {
41+ prNumber = context.issue.number;
42+ } else {
43+ prNumber = context.payload.pull_request.number;
44+ }
45+
46+ const pr = await github.rest.pulls.get({
47+ owner: context.repo.owner,
48+ repo: context.repo.repo,
49+ pull_number: prNumber
50+ });
51+
52+ core.setOutput('sha', pr.data.head.sha);
53+ core.setOutput('repo', pr.data.head.repo.full_name);
54+
55+ - name : Checkout PR branch
56+ if : steps.pr.outcome == 'success'
57+ uses : actions/checkout@v4
58+ with :
59+ ref : ${{ steps.pr.outputs.sha }}
60+ repository : ${{ steps.pr.outputs.repo }}
61+ fetch-depth : 0
62+
3063 - name : Checkout repository
64+ if : steps.pr.outcome != 'success'
3165 uses : actions/checkout@v4
3266 with :
33- fetch-depth : 1
67+ fetch-depth : 0
3468
3569 - name : Run Claude Code
3670 id : claude
You can’t perform that action at this time.
0 commit comments