From 51acc56dcb07fa099efc7f8ec921e4e2c67f3732 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 6 Nov 2025 16:07:31 +0100 Subject: [PATCH] ci/github-script/merge: ignore PRs with >= 100 files We use the files endpoint to get a list of all *names* of files touched in the PR - but this endpoint will also actually download the files / their diff, too. That's pointless and actually takes quite some time for huge treewides. We're just putting in a stop-gap for now, so that we're not burning more than 1 API requests on this and don't spend so much time on it either. A limit of 99 files will be more than enough for quite some time - we will only need to raise this when we're able to represent package sets in by-name properly and have "package set maintainers", who are not committers. --- ci/github-script/merge.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ci/github-script/merge.js b/ci/github-script/merge.js index 688a7928fe97..674d8153a7e9 100644 --- a/ci/github-script/merge.js +++ b/ci/github-script/merge.js @@ -128,11 +128,20 @@ async function handleMerge({ (await getTeamMembers('nixpkgs-committers')).map(({ id }) => id), ) - const files = await github.paginate(github.rest.pulls.listFiles, { - ...context.repo, - pull_number, - per_page: 100, - }) + const files = ( + await github.rest.pulls.listFiles({ + ...context.repo, + pull_number, + per_page: 100, + }) + ).data + + // Early exit to prevent treewides from using up a lot of API requests (and time!) to list + // all the files in the pull request. For now, the merge-bot will not work when 100 or more + // files are touched in a PR - which should be more than fine. + // TODO: Find a more efficient way of downloading all the *names* of the touched files, + // including an early exit when the first non-by-name file is found. + if (files.length >= 100) return false // Only look through comments *after* the latest (force) push. const lastPush = events.findLastIndex(