CI: close PRs with excessive labels

This commit is contained in:
Shadow
2026-02-12 15:35:32 -06:00
parent 3b6bd202da
commit 978effcf26

View File

@@ -105,6 +105,26 @@ jobs:
}
}
const pullRequest = context.payload.pull_request;
if (pullRequest) {
const labelCount = pullRequest.labels?.length ?? 0;
if (labelCount > 20) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullRequest.number,
body: "Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch.",
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullRequest.number,
state: "closed",
});
return;
}
}
const labelName = context.payload.label?.name;
if (!labelName) {
return;