CI: auto-label moltbook issues
This commit is contained in:
parent
a10603f9f0
commit
29de43d307
1 changed files with 37 additions and 1 deletions
38
.github/workflows/auto-response.yml
vendored
38
.github/workflows/auto-response.yml
vendored
|
|
@ -2,7 +2,7 @@ name: Auto response
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [labeled]
|
types: [opened, edited, labeled]
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [labeled]
|
types: [labeled]
|
||||||
|
|
||||||
|
|
@ -45,8 +45,35 @@ jobs:
|
||||||
message:
|
message:
|
||||||
"This would be better made as a third-party extension with our SDK that you maintain yourself. Docs: https://docs.molt.bot/plugin.",
|
"This would be better made as a third-party extension with our SDK that you maintain yourself. Docs: https://docs.molt.bot/plugin.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "r: moltbook",
|
||||||
|
close: true,
|
||||||
|
lock: true,
|
||||||
|
lockReason: "off-topic",
|
||||||
|
message:
|
||||||
|
"OpenClaw is not affiliated with Moltbook, and issues related to Moltbook should not be submitted here.",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const issue = context.payload.issue;
|
||||||
|
if (issue) {
|
||||||
|
const title = issue.title ?? "";
|
||||||
|
const body = issue.body ?? "";
|
||||||
|
const haystack = `${title}\n${body}`.toLowerCase();
|
||||||
|
const hasLabel = (issue.labels ?? []).some((label) =>
|
||||||
|
typeof label === "string" ? label === "r: moltbook" : label?.name === "r: moltbook",
|
||||||
|
);
|
||||||
|
if (haystack.includes("moltbook") && !hasLabel) {
|
||||||
|
await github.rest.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issue.number,
|
||||||
|
labels: ["r: moltbook"],
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const labelName = context.payload.label?.name;
|
const labelName = context.payload.label?.name;
|
||||||
if (!labelName) {
|
if (!labelName) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -77,3 +104,12 @@ jobs:
|
||||||
state: "closed",
|
state: "closed",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rule.lock) {
|
||||||
|
await github.rest.issues.lock({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
lock_reason: rule.lockReason ?? "resolved",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue