Skip to content

Commit 783581d

Browse files
fix(ci): fork PRs now resolve in workflow_run PR lookups (#26779)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 861a51a commit 783581d

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

‎.github/workflows/desktop-macos-preview-publish.yml‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,19 @@ jobs:
7777
return;
7878
}
7979
80-
// workflow_run.pull_requests is empty for fork PRs, so resolve the
81-
// PR from the built commit instead and require exactly one open PR
82-
// from the same head repository and branch. The build baked its
80+
// workflow_run.pull_requests and the commit-to-PR lookup are both
81+
// empty for fork PRs, so list open PRs by head owner and branch
82+
// and require exactly one at the built commit. The build baked its
8383
// PR number into the version, so two candidates would mean the
8484
// asset name could belong to either.
85-
const associated = await github.paginate(
86-
github.rest.repos.listPullRequestsAssociatedWithCommit,
87-
{ owner, repo, commit_sha: run.head_sha, per_page: 100 },
88-
);
89-
const matching = associated.filter(
85+
const open = await github.paginate(github.rest.pulls.list, {
86+
owner,
87+
repo,
88+
state: "open",
89+
head: `${run.head_repository?.owner?.login}:${run.head_branch}`,
90+
per_page: 100,
91+
});
92+
const matching = open.filter(
9093
(candidate) =>
9194
candidate.state === "open" &&
9295
candidate.head.sha === run.head_sha &&

‎.github/workflows/mobile-fingerprint-label.yml‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,18 @@ jobs:
5353
return;
5454
}
5555
56-
// workflow_run.pull_requests is empty for fork PRs, so resolve the
57-
// PR from the checked commit. Requiring the PR's current head to be
58-
// that commit keeps a slow run for an older push from overwriting a
59-
// newer result.
60-
const associated = await github.paginate(
61-
github.rest.repos.listPullRequestsAssociatedWithCommit,
62-
{ owner, repo, commit_sha: run.head_sha, per_page: 100 },
63-
);
64-
const matching = associated.filter(
56+
// workflow_run.pull_requests and the commit-to-PR lookup are both
57+
// empty for fork PRs, so list open PRs by head owner and branch.
58+
// Requiring the PR's current head to be the checked commit keeps a
59+
// slow run for an older push from overwriting a newer result.
60+
const open = await github.paginate(github.rest.pulls.list, {
61+
owner,
62+
repo,
63+
state: "open",
64+
head: `${run.head_repository?.owner?.login}:${run.head_branch}`,
65+
per_page: 100,
66+
});
67+
const matching = open.filter(
6568
(candidate) =>
6669
candidate.state === "open" &&
6770
candidate.head.sha === run.head_sha &&

0 commit comments

Comments
 (0)