mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-22 07:54:03 +00:00
fix(github): preserve clawsweeper proof labels (#83781)
This commit is contained in:
@@ -794,13 +794,36 @@ async function addMissingLabels(github, context, core, issueNumber, labels, labe
|
||||
core.info(`Added candidate labels to #${issueNumber}: ${missingLabels.join(", ")}`);
|
||||
}
|
||||
|
||||
function shouldRemoveProofSufficientLabel(context, proofEvaluation, hasExactHeadClawSweeperProof) {
|
||||
function isClawSweeperOwnedLabel(label) {
|
||||
return label === "clawsweeper" || label.startsWith("clawsweeper:");
|
||||
}
|
||||
|
||||
function isActiveClawSweeperWork(pullRequest, labelSet) {
|
||||
const authorLogin = pullRequest.user?.login ?? "";
|
||||
const headRef = pullRequest.head?.ref ?? "";
|
||||
return (
|
||||
/clawsweeper/i.test(authorLogin) ||
|
||||
headRef.startsWith("clawsweeper/") ||
|
||||
[...labelSet].some(isClawSweeperOwnedLabel)
|
||||
);
|
||||
}
|
||||
|
||||
function shouldRemoveProofSufficientLabel(
|
||||
context,
|
||||
pullRequest,
|
||||
labelSet,
|
||||
proofEvaluation,
|
||||
hasExactHeadClawSweeperProof,
|
||||
) {
|
||||
if (hasExactHeadClawSweeperProof) {
|
||||
return false;
|
||||
}
|
||||
if (proofEvaluation.status === "override") {
|
||||
return false;
|
||||
}
|
||||
if (isActiveClawSweeperWork(pullRequest, labelSet)) {
|
||||
return false;
|
||||
}
|
||||
if (!["edited", "synchronize"].includes(context.payload.action)) {
|
||||
return false;
|
||||
}
|
||||
@@ -836,7 +859,13 @@ async function applyPullRequestCandidateLabels(github, context, core, pullReques
|
||||
);
|
||||
if (
|
||||
labelSet.has(PROOF_SUFFICIENT_LABEL) &&
|
||||
shouldRemoveProofSufficientLabel(context, proofEvaluation, hasExactHeadClawSweeperProof)
|
||||
shouldRemoveProofSufficientLabel(
|
||||
context,
|
||||
pullRequest,
|
||||
labelSet,
|
||||
proofEvaluation,
|
||||
hasExactHeadClawSweeperProof,
|
||||
)
|
||||
) {
|
||||
staleProofLabels.push(PROOF_SUFFICIENT_LABEL);
|
||||
}
|
||||
@@ -927,6 +956,9 @@ async function removeLabels(github, context, issueNumber, labels, labelSet) {
|
||||
if (!labelSet.has(label)) {
|
||||
continue;
|
||||
}
|
||||
if (isClawSweeperOwnedLabel(label)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
|
||||
Reference in New Issue
Block a user