mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 19:01:47 +03:00
CI: add dirty label auto-response
This commit is contained in:
@@ -132,16 +132,34 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const invalidLabel = "invalid";
|
const invalidLabel = "invalid";
|
||||||
|
const dirtyLabel = "dirty";
|
||||||
|
const noisyPrMessage =
|
||||||
|
"Closing this PR because it looks dirty (too many unrelated commits). Please recreate the PR from a clean branch.";
|
||||||
|
|
||||||
const pullRequest = context.payload.pull_request;
|
const pullRequest = context.payload.pull_request;
|
||||||
if (pullRequest) {
|
if (pullRequest) {
|
||||||
|
if (labelSet.has(dirtyLabel)) {
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: pullRequest.number,
|
||||||
|
body: noisyPrMessage,
|
||||||
|
});
|
||||||
|
await github.rest.issues.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: pullRequest.number,
|
||||||
|
state: "closed",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const labelCount = labelSet.size;
|
const labelCount = labelSet.size;
|
||||||
if (labelCount > 20) {
|
if (labelCount > 20) {
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
issue_number: pullRequest.number,
|
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.",
|
body: noisyPrMessage,
|
||||||
});
|
});
|
||||||
await github.rest.issues.update({
|
await github.rest.issues.update({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
|
|||||||
Reference in New Issue
Block a user