Skip to content

Commit 90ae151

Browse files
fix: prevent barnacle vetoing clawsweeper proof
1 parent 372a8e4 commit 90ae151

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

‎scripts/github/barnacle-auto-response.mjs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,16 @@ function isAutomationActor(context) {
828828
return isAutomationUser(context.payload.sender, context.actor ?? "");
829829
}
830830

831+
function isClawSweeperProofSufficientLabelEvent(context) {
832+
const senderLogin = context.payload.sender?.login ?? context.actor ?? "";
833+
return (
834+
context.payload.action === "labeled" &&
835+
context.payload.label?.name === PROOF_SUFFICIENT_LABEL &&
836+
isAutomationUser(context.payload.sender, senderLogin) &&
837+
/clawsweeper/i.test(senderLogin)
838+
);
839+
}
840+
831841
function isGitHubAppPullRequestAuthor(pullRequest) {
832842
return isAutomationUser(pullRequest.user);
833843
}
@@ -1075,6 +1085,13 @@ export async function runBarnacleAutoResponse({ github, context, core = console
10751085
return;
10761086
}
10771087

1088+
if (isClawSweeperProofSufficientLabelEvent(context)) {
1089+
core.info(
1090+
`Skipping PR auto-response checks for #${pullRequest.number} because ClawSweeper owns ${PROOF_SUFFICIENT_LABEL}.`,
1091+
);
1092+
return;
1093+
}
1094+
10781095
if (isGitHubAppPullRequestAuthor(pullRequest)) {
10791096
await removeLabels(github, context, pullRequest.number, [activePrLimitLabel], labelSet);
10801097
core.info(`Skipping active PR limit for GitHub App-authored PR #${pullRequest.number}.`);

‎test/scripts/barnacle-auto-response.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,26 @@ describe("barnacle-auto-response", () => {
810810
expect(calls.removeLabel).toEqual([]);
811811
});
812812

813+
it("does not let Barnacle veto ClawSweeper's sufficient proof label add", async () => {
814+
const { calls, github } = barnacleGithub([file("src/gateway/server.ts")]);
815+
816+
await runBarnacleAutoResponse({
817+
github,
818+
context: barnacleContext({}, [PROOF_SUFFICIENT_LABEL], {
819+
action: "labeled",
820+
label: { name: PROOF_SUFFICIENT_LABEL },
821+
sender: { login: "openclaw-clawsweeper[bot]", type: "Bot" },
822+
}),
823+
core: {
824+
info: () => undefined,
825+
},
826+
});
827+
828+
expect(calls.removeLabel).toEqual([]);
829+
expect(calls.addLabels).toEqual([]);
830+
expect(calls.update).toEqual([]);
831+
});
832+
813833
it("actions manually applied candidate labels", async () => {
814834
const { calls, github } = barnacleGithub([file("extensions/example/openclaw.plugin.json")]);
815835

0 commit comments

Comments
 (0)