fix: match label_trigger case-insensitively - #1576
Open
sahilempire wants to merge 1 commit into
Open
Conversation
label_trigger used a case-sensitive exact comparison, so a workflow configured with label_trigger: "claude-task" did not fire when an issue received a label named "Claude-Task" (the same label name with different casing). GitHub label names are unique without regard to case, so comparing without case is unambiguous. It also matches the trigger_phrase check in the same function, which is already case-insensitive. Compare labelName and labelTrigger with toLowerCase(), and add a test covering a mixed-case label. Fixes anthropics#1571
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
label_triggermatched labels with a case-sensitive exact comparison, so aworkflow configured with
label_trigger: "claude-task"did not fire when anissue received a label named
Claude-Task(the same label name in differentcasing).
Fix
Compare the incoming label name and the configured
label_triggerwithtoLowerCase()incheckContainsTrigger. GitHub label names are uniquewithout regard to case, so this comparison is unambiguous. It also matches the
trigger_phrasecheck in the same function, which is already case-insensitive.Tests
Added a unit test covering a label whose name differs from the trigger only in
case. All checks pass locally:
bun test(805 pass, 0 fail)bun run typecheck(clean)bun run format:check(clean)Fixes #1571