File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed
Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -85,23 +85,17 @@ jobs:
8585 console.log(`PR branch='${prBranch}', headSha='${headSha}', author='${prUser}'`);
8686 console.log(`Command parsed => sub='${sub}', arg='${arg || ''}'`);
8787 // Fetch workflow runs in this repo triggered by this user on this branch, then filter by headSha
88- let page = 1;
89- const allRunsRaw = [];
90- while (true) {
91- const { data } = await github.rest.actions.listWorkflowRunsForRepo({
92- owner: context.repo.owner,
93- repo: context.repo.repo,
94- actor: prUser,
95- branch: prBranch,
96- per_page: 100,
97- page
98- });
99- const wr = data.workflow_runs || [];
100- if (wr.length === 0) break;
101- allRunsRaw.push(...wr);
102- if (wr.length < 100) break;
103- page++;
104- }
88+ const allRunsRaw = await github.paginate(
89+ github.rest.actions.listWorkflowRunsForRepo,
90+ {
91+ owner: context.repo.owner,
92+ repo: context.repo.repo,
93+ actor: prUser,
94+ branch: prBranch,
95+ per_page: 100,
96+ },
97+ (response) => response.data.workflow_runs
98+ );
10599 const runsAtHead = allRunsRaw.filter(r => r.head_sha === headSha);
106100 if (runsAtHead.length === 0) {
107101 console.error(`No workflow runs found for head SHA ${headSha} on branch ${prBranch}.`);
You can’t perform that action at this time.
0 commit comments