diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 83225b6dc..534911fcd 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -111,8 +111,8 @@ jobs: const { owner, repo } = context.repo; const issue_number = context.payload.pull_request.number; const marker = ""; - const comments = await github.rest.issues.listComments({ owner, repo, issue_number }); - const existing = comments.data.find((c) => c.body?.includes(marker)); + const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number }); + const existing = comments.find((c) => c.body?.includes(marker)); const payload = `${marker}\n${body}`; if (existing) await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body: payload }); else await github.rest.issues.createComment({ owner, repo, issue_number, body: payload }); @@ -130,7 +130,7 @@ jobs: const { owner, repo } = context.repo; const issue_number = context.payload.pull_request.number; const marker = ""; - const comments = await github.rest.issues.listComments({ owner, repo, issue_number }); - const existing = comments.data.find((c) => c.body?.includes(marker)); + const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number }); + const existing = comments.find((c) => c.body?.includes(marker)); if (existing) await github.rest.issues.deleteComment({ owner, repo, comment_id: existing.id }); try { await github.rest.issues.removeLabel({ owner, repo, issue_number, name: "blocked: template" }); } catch {} diff --git a/scripts/check-pr-template.mjs b/scripts/check-pr-template.mjs index 53cebb047..eeffb4a0a 100644 --- a/scripts/check-pr-template.mjs +++ b/scripts/check-pr-template.mjs @@ -19,7 +19,13 @@ if (!bodyFile) { process.exit(2); } -const body = readFileSync(bodyFile, "utf8").replace(/\r\n/g, "\n"); +let body; +try { + body = readFileSync(bodyFile, "utf8").replace(/\r\n/g, "\n"); +} catch (e) { + console.error(`cannot read body file ${bodyFile}: ${e.message}`); + process.exit(2); +} const association = (process.env.AUTHOR_ASSOCIATION || "").toUpperCase(); const isMaintainer = ["OWNER", "MEMBER", "COLLABORATOR"].includes(association);