fix(pr-validation): paginate issue comments + guard unreadable body file

Addresses review: github.rest.issues.listComments only returns the first page,
so the sticky-comment marker could be missed on busy PRs — use github.paginate.
And guard readFileSync so a missing/unreadable body file exits 2 (per the doc)
instead of crashing without JSON.
This commit is contained in:
Gauvino
2026-06-01 20:22:28 +02:00
parent 5f59dce0c7
commit 935cacff81
2 changed files with 11 additions and 5 deletions

View File

@@ -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);