Skip to content

Commit

Permalink
Paginate PR commit listing
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Oct 10, 2023
1 parent 47a2043 commit 8811450
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions services/bots/src/github-webhook/handlers/validate-cla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ export class ValidateCla extends BaseWebhookHandler {
}
}

const commits = await context.github.pulls.listCommits(context.pullRequest({ per_page: 100 }));
const allCommitsIgnored = commits.data.every(
const commits = await context.github.paginate(
context.github.pulls.listCommits,
context.pullRequest({ per_page: 100 }),
);
const allCommitsIgnored = commits.every(
(commit) => commit.author?.type === 'Bot' || ignoredAuthors.has(commit.commit?.author?.email),
);

for await (const commit of commits.data) {
for await (const commit of commits) {
if (commit.author?.type === 'Bot' || ignoredAuthors.has(commit.commit?.author?.email)) {
continue;
}
Expand Down Expand Up @@ -214,7 +217,7 @@ export class ValidateCla extends BaseWebhookHandler {
// ignroe missing label
}

commits.data.forEach((commit) => {
commits.forEach((commit) => {
context.github.repos.createCommitStatus(
context.repo({
sha: commit.sha,
Expand Down

0 comments on commit 8811450

Please sign in to comment.