fix(ci): route the sticky comment by PR identity, not by list order

The fork fallback took `prs[0]` from the commit's PR associations without
checking any of them is still this run's head, so a stale association could
collect another branch's report. Match on head sha, ref and repository, and skip
when nothing matches. Verified against a synthesised association list where the
stale PR is listed first: the old lookup picks it, the new one does not.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-24 19:34:09 +07:00
co-authored by Claude Opus 4.8
parent 162c84d99a
commit 280d7b9231
+7 -1
View File
@@ -63,7 +63,13 @@ jobs:
repo: context.repo.repo,
commit_sha: run.head_sha,
});
prNumber = prs[0]?.number;
// One commit can be associated with several PRs, so match the one whose head is
// still this run's — `prs[0]` hands the report to whichever is listed first.
prNumber = prs.find((pr) =>
pr.head?.sha === run.head_sha &&
pr.head?.ref === run.head_branch &&
pr.head?.repo?.full_name === run.head_repository?.full_name
)?.number;
}
if (!prNumber) {
core.info(`No PR found for ${run.head_sha}; skipping comment.`);