-
Notifications
You must be signed in to change notification settings - Fork 240
feat: improve keyword matching with word boundaries #1371
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
base: development
Are you sure you want to change the base?
Conversation
Add auto-reply GitHub Action
Reviewer's GuideIntroduces a new GitHub Actions workflow that triggers on issue comments, scans for assignment-request phrases with github-script, and automatically posts a standardized reply guiding contributors to open a PR without formal assignment. Sequence diagram for auto-reply to assignment request commentssequenceDiagram
actor User
participant GitHub as GitHub
participant Action as Auto-reply Action
participant Script as github-script
User->>GitHub: Post comment on issue
GitHub->>Action: Trigger issue_comment event
Action->>Script: Run github-script step
Script->>Script: Check for assignment phrases
alt Assignment phrase found
Script->>GitHub: Post standard reply comment
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @CogniCodes - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `.github/workflows/auto-reply.yml:18` </location>
<code_context>
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const comment = context.payload.comment.body.toLowerCase();
+ const keywords = ["assign","work on this","take this up","pick this","want this"];
+ const matched = keywords.some(keyword => comment.includes(keyword));
+
</code_context>
<issue_to_address>
Keyword matching is case-insensitive but may match substrings unintentionally.
Consider using regular expressions with word boundaries to avoid matching keywords as substrings within other words.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
const comment = context.payload.comment.body.toLowerCase();
const keywords = ["assign","work on this","take this up","pick this","want this"];
const matched = keywords.some(keyword => comment.includes(keyword));
=======
const comment = context.payload.comment.body;
const keywords = ["assign","work on this","take this up","pick this","want this"];
const matched = keywords.some(keyword => {
const pattern = new RegExp(`\\b${keyword.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}\\b`, 'i');
return pattern.test(comment);
});
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@CogniCodes thank you very much for working on this. Your implementation works well! To make it easier to update in the future, what do you think about the following suggestions:
|
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.
To prevent repeated comments if users comment multiple times, you can
Check existing bot comments before replying.
If someone comments twice with “assign” or similar, the bot will comment each time. This creates noise.
Thank you for the suggestions. I'll make the changes shortly and push the updates. |
Updated workflow based on suggestions
Hi @hpdang and @samruddhi-Rahegaonkar , Thank you for your time and feedback |
Made these changes as per your feedback.. - Moved static keywords and messages to environment variables for easier configuration. - Ensured the bot replies only once per commenter to prevent spam. - Added user tagging for better context.
Build StatusBuild successful. APKs to test: https://github.com/fossasia/badgemagic-app/actions/runs/16371716205/artifacts/3572807924. Screenshots (Android)
Screenshots (iPhone)
Screenshots (iPad)
|
Summary
This pull request adds a GitHub Action that automatically replies to issue comments containing common assignment request phrases.
What It Does
Why It's Useful
Let me know if any further improvements are needed! I'd like to help further whether needed!
Summary by Sourcery
Add a GitHub Actions workflow that automatically replies to issue comments requesting assignments with a standard message guiding contributors to open pull requests
New Features:
CI: