-
Couldn't load subscription status.
- Fork 60
Better trigger detection #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better trigger detection #419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances trigger word detection to match complete triggers only, preventing false matches when one trigger is a prefix of another (e.g., .deploy vs .deploy-dev). The change adds validation to ensure that a trigger match is either at the end of the string or followed by whitespace, preventing both actions from running when only one should be triggered.
Key Changes:
- Added boundary validation after trigger detection to verify complete word matches
- Implemented comprehensive test coverage for the new validation logic
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/functions/trigger-check.js | Added validation to ensure trigger matches are complete by checking the character following the trigger |
| tests/functions/trigger-check.test.js | Added three test cases covering prefix conflicts, alphanumeric suffixes, and whitespace boundaries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.
This PR modifies the trigger word detection to match the complete trigger and only the complete trigger. I use this action extensively (thank you!) but to make iterating on an action easier, I have sometimes needed to have two copies of the action in a repository with two different triggers, i.e.
.deployand.deploy-dev. When making a comment with the latter trigger word, it causes both actions to run.I have added (with some LLM assistance, as my NodeJS skills are nothing to brag about) an extra
ifstatement to catch this situation along with some test cases.