@@ -26,12 +26,37 @@ jobs:
26
26
with :
27
27
ref : ${{ github.event.pull_request.head.ref }}
28
28
29
+ # For fork PRs that are manually triggered, we need to get the PR details first
30
+ - name : Get PR details for fork
31
+ if : ${{ github.event_name == 'workflow_dispatch' }}
32
+ id : pr_details
33
+ uses : actions/github-script@v7
34
+ with :
35
+ script : |
36
+ const prNumber = ${{ inputs.pull_request_number }};
37
+
38
+ // Get PR details to find the head SHA
39
+ const { data: pr } = await github.rest.pulls.get({
40
+ owner: context.repo.owner,
41
+ repo: context.repo.repo,
42
+ pull_number: prNumber
43
+ });
44
+
45
+ console.log(`Fork PR head SHA: ${pr.head.sha}`);
46
+ console.log(`Fork PR head ref: ${pr.head.ref}`);
47
+ console.log(`Fork PR repo: ${pr.head.repo.full_name}`);
48
+
49
+ // Set outputs for checkout step
50
+ core.setOutput('head_sha', pr.head.sha);
51
+ core.setOutput('head_ref', pr.head.ref);
52
+ core.setOutput('repo_full_name', pr.head.repo.full_name);
53
+
29
54
- name : Checkout for manually triggered fork PR
30
55
if : ${{ github.event_name == 'workflow_dispatch' }}
31
56
uses : actions/checkout@v4
32
57
with :
33
- ref : ${{ github.sha }}
34
- repository : ${{ github.event.pull_request.head.repo.full_name }}
58
+ ref : ${{ steps.pr_details.outputs.head_sha }}
59
+ repository : ${{ steps.pr_details.outputs.repo_full_name }}
35
60
36
61
- name : Setup Ruby
37
62
uses : ruby/setup-ruby@v1
77
102
if ('${{ github.event_name }}' === 'pull_request') {
78
103
commitSha = '${{ github.event.pull_request.head.sha }}';
79
104
} else {
80
- // For workflow_dispatch, get the SHA from the current commit
81
- commitSha = '${{ github.sha }}';
105
+ // For workflow_dispatch, get the SHA from the PR details
106
+ commitSha = '${{ steps.pr_details.outputs.head_sha }}';
82
107
}
83
108
84
109
// Get all comments on the PR
0 commit comments