File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,16 +60,17 @@ jobs:
6060 return;
6161 }
6262
63- // 2. For forks that list is empty, so find the open Pull Request whose HEAD SHA matches
64- // the commit that triggered the run.
65- const pulls = await github.paginate(github. rest.pulls.list, {
63+ // 2. For forks that list is empty, so find the open Pull Request who has the
64+ // correct branch information
65+ const match = await github.rest.pulls.list( {
6666 owner: context.repo.owner,
6767 repo: context.repo.repo,
68- state: 'open',
69- per_page: 100,
70- });
71-
72- const match = pulls.find(pull => pull.head.sha === run.head_sha);
68+ state: "open",
69+ head: `${context.payload.workflow_run.head_repository.owner.login}:${context.payload.workflow_run.head_branch}`,
70+ sort: "updated",
71+ direction: "desc",
72+ per_page: 1,
73+ }).then(r => r.data[0]);
7374
7475 if (!match) {
7576 core.info(`No open pull request found for HEAD ${run.head_sha}`);
You can’t perform that action at this time.
0 commit comments