Skip to content

Commit 0d69c11

Browse files
authored
fix: Paginate list comments (#53)
1 parent 1ca4327 commit 0d69c11

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/comment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export async function createOrUpdateComment({
7777
content: string
7878
}): Promise<void> {
7979
// Get all PR comments
80-
const comments = await octokit.rest.issues.listComments({
80+
const comments = await octokit.paginate(octokit.rest.issues.listComments, {
8181
owner: github.context.repo.owner,
8282
repo: github.context.repo.repo,
8383
issue_number: github.context.issue.number
@@ -86,7 +86,7 @@ export async function createOrUpdateComment({
8686
// Check if any comment already starts with the header that we expect. If so,
8787
// let's update the comment with the new content.
8888
const header = content.split('\n')[0]
89-
for (const comment of comments.data) {
89+
for (const comment of comments) {
9090
if (comment.body?.startsWith(header)) {
9191
await octokit.rest.issues.updateComment({
9292
owner: github.context.repo.owner,

0 commit comments

Comments
 (0)