CI: close PRs with excessive labels

feature/PAZ-358-fe-credit-error-display
Shadow 9 months ago
parent 3b6bd202da
commit 978effcf26
No known key found for this signature in database

@ -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;

Loading…
Cancel
Save