From db9582ad66c1fef527971b94cdf40649e791ff80 Mon Sep 17 00:00:00 2001 From: Cheng Date: Fri, 28 Aug 2026 09:03:47 +0900 Subject: [PATCH] Update rules for PR limitation bypass list --- .github/scripts/find-eligible-contributors.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/scripts/find-eligible-contributors.js b/.github/scripts/find-eligible-contributors.js index f5a05396ce..296c8f2be6 100644 --- a/.github/scripts/find-eligible-contributors.js +++ b/.github/scripts/find-eligible-contributors.js @@ -8,6 +8,7 @@ * - fewer than 5 currently open PRs * - more than 2 merged PRs * - merge rate (merged / closed) > 50% + * - "low priority" PRs < 50% * * Usage: * GITHUB_TOKEN=xxxx node find-eligible-contributors.js @@ -95,6 +96,8 @@ async function fetchCollaborators(owner, repo, token) { * open: number, * closed: number, * merged: number, + * total: number, + * lowPriority: number, * mostRecentCreatedAt: Date * }> */ @@ -110,11 +113,18 @@ function aggregateUserStats(pullRequests) { open: 0, closed: 0, merged: 0, + total: 0, + lowPriority: 0, mostRecentCreatedAt: null, }); } const s = stats.get(login); + s.total += 1; + if (pr.labels?.some((label) => label.name === 'low priority')) { + s.lowPriority += 1; + } + if (pr.state === 'open') { s.open += 1; } else if (pr.state === 'closed') { @@ -138,6 +148,7 @@ function aggregateUserStats(pullRequests) { * - fewer than 5 currently open PRs * - more than 2 merged PRs * - merge rate (merged / closed) > 50% + * - "low priority" PRs < 50% * - not a collaborator * - has an open PR or at least one PR within the past 6 weeks */ @@ -152,6 +163,7 @@ function filterEligibleUsers(stats, collaboratorLogins) { if (collaboratorLogins.has(login)) continue; if (s.open == 0 && s.mostRecentCreatedAt < cutoff) continue; if ((s.merged / s.closed) < 0.5) continue; + if ((s.lowPriority / s.total) > 0.5) continue; eligible.push(login); }