We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3da9b17 commit c409c4bCopy full SHA for c409c4b
1 file changed
.github/workflows/pr-comment.yml
@@ -20,9 +20,19 @@ jobs:
20
with:
21
script: |
22
const runId = context.payload.workflow_run.id;
23
- const pr = context.payload.workflow_run.pull_requests[0];
+ const headSha = context.payload.workflow_run.head_sha;
24
+
25
+ // Look up the PR by head SHA — works for fork PRs too
26
+ const prs = await github.rest.pulls.list({
27
+ owner: context.repo.owner,
28
+ repo: context.repo.repo,
29
+ state: 'open',
30
+ sort: 'updated',
31
+ per_page: 20,
32
+ });
33
+ const pr = prs.data.find(p => p.head.sha === headSha);
34
if (!pr) {
- console.log('No PR associated, skipping.');
35
+ console.log(`No open PR found for SHA ${headSha}, skipping.`);
36
return;
37
}
38
0 commit comments