diff --git a/lib/coding-agent/__tests__/onMergeTestToMainAction.test.ts b/lib/coding-agent/__tests__/onMergeTestToMainAction.test.ts index b76c6be1..8405b85f 100644 --- a/lib/coding-agent/__tests__/onMergeTestToMainAction.test.ts +++ b/lib/coding-agent/__tests__/onMergeTestToMainAction.test.ts @@ -19,10 +19,10 @@ function createMockBot() { } describe("registerOnMergeTestToMainAction", () => { - it("registers merge_test_to_main: action handler", () => { + it("registers catch-all action handler", () => { const bot = createMockBot(); registerOnMergeTestToMainAction(bot); - expect(bot.onAction).toHaveBeenCalledWith("merge_test_to_main:", expect.any(Function)); + expect(bot.onAction).toHaveBeenCalledWith(expect.any(Function)); }); it("merges test to main and posts success", async () => { @@ -30,7 +30,7 @@ describe("registerOnMergeTestToMainAction", () => { const bot = createMockBot(); registerOnMergeTestToMainAction(bot); - const handler = bot.onAction.mock.calls[0][1]; + const handler = bot.onAction.mock.calls[0][0]; const mockThread = { post: vi.fn() }; @@ -45,7 +45,7 @@ describe("registerOnMergeTestToMainAction", () => { const bot = createMockBot(); registerOnMergeTestToMainAction(bot); - const handler = bot.onAction.mock.calls[0][1]; + const handler = bot.onAction.mock.calls[0][0]; const mockThread = { post: vi.fn() }; @@ -61,7 +61,7 @@ describe("registerOnMergeTestToMainAction", () => { const bot = createMockBot(); registerOnMergeTestToMainAction(bot); - const handler = bot.onAction.mock.calls[0][1]; + const handler = bot.onAction.mock.calls[0][0]; const mockThread = { post: vi.fn() }; diff --git a/lib/coding-agent/handlers/onMergeTestToMainAction.ts b/lib/coding-agent/handlers/onMergeTestToMainAction.ts index ad4f0209..57932baa 100644 --- a/lib/coding-agent/handlers/onMergeTestToMainAction.ts +++ b/lib/coding-agent/handlers/onMergeTestToMainAction.ts @@ -9,7 +9,9 @@ import { parseMergeTestToMainActionId } from "../parseMergeTestToMainActionId"; * @param bot */ export function registerOnMergeTestToMainAction(bot: CodingAgentBot) { - bot.onAction("merge_test_to_main:", async event => { + bot.onAction(async event => { + if (!event.actionId.startsWith("merge_test_to_main:")) return; + const thread = event.thread; const repo = parseMergeTestToMainActionId(event.actionId);