Skip to content

Commit

Permalink
Add pagination to comment lookup query.
Browse files Browse the repository at this point in the history
  • Loading branch information
desrosj committed Feb 5, 2024
1 parent f10ee17 commit 02f13f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
23 changes: 15 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions src/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,21 @@ export default class GitHub {
body: commentMessage,
};

const comments = (await this.octokit.rest.issues.listComments(commentInfo))
.data;
for (const currentComment of comments) {
if (
currentComment.user.type === "Bot" &&
currentComment.body.includes( 'The following accounts have interacted with this PR and/or linked issues.' )
) {
commentId = currentComment.id;
for await (const response of this.octokit.paginate.iterator(
this.octokit.rest.issues.listForRepo,
commentInfo
)) {
for (const currentComment of response.data) {
if (
currentComment.user.type === "Bot" &&
currentComment.body.includes( 'The following accounts have interacted with this PR and/or linked issues.' )
) {
commentId = currentComment.id;
break;
}
}

if ( commentId ) {
break;
}
}
Expand Down

0 comments on commit 02f13f8

Please sign in to comment.