diff --git a/scripts/runner.node.mjs b/scripts/runner.node.mjs index cd016a7420..9687fbde1a 100755 --- a/scripts/runner.node.mjs +++ b/scripts/runner.node.mjs @@ -187,9 +187,10 @@ let prFileCount = 0; if (isBuildkite) { try { console.log("on buildkite: collecting new files from PR"); + const per_page = 50; for (let i = 1; i <= 5; i++) { const res = await fetch( - `https://api.github.com/repos/oven-sh/bun/pulls/${process.env.BUILDKITE_PULL_REQUEST}/files?per_page=50&page=${i}`, + `https://api.github.com/repos/oven-sh/bun/pulls/${process.env.BUILDKITE_PULL_REQUEST}/files?per_page=${per_page}&page=${i}`, { headers: { Authorization: `Bearer ${getSecret("GITHUB_TOKEN")}`, @@ -199,6 +200,7 @@ if (isBuildkite) { const doc = await res.json(); console.log(`-> page ${i}, found ${doc.length} items`); if (doc.length === 0) break; + if (doc.length < per_page) break; for (const { filename, status } of doc) { prFileCount += 1; if (status !== "added") continue;