stale-blocked: Reduce threshold if number blocked PR exceeds 10

This commit is contained in:
bbhtt
2026-03-09 18:14:10 +05:30
parent 5b509661ab
commit 681d290812
+12 -2
View File
@@ -63,6 +63,16 @@ jobs:
per_page: 100
});
const blockedCount = prs.filter(pr =>
pr.labels.some(l => l.name === labelBlocked)
).length;
let globalThreshold = daysThreshold;
if (blockedCount > 10) {
globalThreshold = Math.floor(daysThreshold / 2);
}
for (const pr of prs) {
const prLabels = pr.labels.map(l => l.name);
const hasBlocked = prLabels.includes(labelBlocked);
@@ -73,8 +83,8 @@ jobs:
if (prLabels.includes(exemptLabel)) continue;
const effectiveThreshold = hasChecks
? Math.floor(daysThreshold / 2)
: daysThreshold;
? Math.floor(globalThreshold / 2)
: globalThreshold;
const commentTemplate = hasBlocked && hasChecks
? commentTemplates.both