diff --git a/src/github/validation/trigger.ts b/src/github/validation/trigger.ts index 01724e0f..41c9e327 100644 --- a/src/github/validation/trigger.ts +++ b/src/github/validation/trigger.ts @@ -38,7 +38,10 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean { if (isIssuesEvent(context) && context.eventAction === "labeled") { const labelName = (context.payload as any).label?.name || ""; - if (labelTrigger && labelName === labelTrigger) { + if ( + labelTrigger && + labelName.toLowerCase() === labelTrigger.toLowerCase() + ) { console.log(`Issue labeled with trigger label '${labelTrigger}'`); return true; } diff --git a/test/trigger-validation.test.ts b/test/trigger-validation.test.ts index 27516432..611b6fc3 100644 --- a/test/trigger-validation.test.ts +++ b/test/trigger-validation.test.ts @@ -134,6 +134,20 @@ describe("checkContainsTrigger", () => { expect(checkContainsTrigger(context)).toBe(false); }); + it("should return true when the labeled name differs only in case from the trigger", () => { + const context = { + ...mockIssueLabeledContext, + payload: { + ...mockIssueLabeledContext.payload, + label: { + ...(mockIssueLabeledContext.payload as any).label, + name: "Claude-Task", + }, + }, + } as ParsedGitHubContext; + expect(checkContainsTrigger(context)).toBe(true); + }); + it("should return false for non-labeled events", () => { const context = { ...mockIssueLabeledContext,