Skip to content

Conversation

CogniCodes
Copy link

@CogniCodes CogniCodes commented Jul 17, 2025

Summary
This pull request adds a GitHub Action that automatically replies to issue comments containing common assignment request phrases.

What It Does

  • Listens to issue_comment events
  • Checks if the comment includes phrases like:
    • "assign this to me"
    • "please assign"
    • "I want to work on this"
    • "I want to take this up"
    • "assign me this", etc.
  • Replies with a standard message encouraging contributors to proceed without formal assignment.

Why It's Useful

  • Helps new contributors understand how to proceed
  • Saves maintainers time
  • Provides a welcoming experience for first-time contributors

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:

  • Automatically respond to issue comments containing assignment-related keywords with guidance on proceeding without formal assignment

CI:

  • Add auto-reply.yml workflow to listen for new issue comments and post the standard reply

Add auto-reply GitHub Action
Copy link
Contributor

sourcery-ai bot commented Jul 17, 2025

Reviewer's Guide

Introduces 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 comments

sequenceDiagram
  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
Loading

File-Level Changes

Change Details Files
Add auto-reply GitHub Action for assignment requests
  • Create a workflow file for issue_comment.created events
  • Add condition to ignore pull request comments
  • Use actions/github-script@v7 to parse comment text for keywords
  • Post a standardized reply when a keyword match is found
.github/workflows/auto-reply.yml

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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 CogniCodes changed the title Add GitHub action for auto-reply to issue assignment comments feat: improve keyword matching with word boundaries Jul 17, 2025
@hpdang
Copy link
Member

hpdang commented Jul 18, 2025

@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:

  1. Configurable Keywords and Response:
  • Instead of hardcoding the keywords (["assign", "work on this", ...]) and response message in the script, move them to environment variables in the env section. This allows us to update them easily without changing the script.
  1. Tag the Commenter:
  • Add the commenter’s username (e.g., @username) at the beginning of the auto-response to personalize it and ensure they get notified.

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.

@CogniCodes
Copy link
Author

CogniCodes commented Jul 18, 2025

Thank you for the suggestions. I'll make the changes shortly and push the updates.

Updated workflow based on suggestions
@CogniCodes
Copy link
Author

Hi @hpdang and @samruddhi-Rahegaonkar ,
I've made the changes as per your suggestions. Please let me know if anything else is needed.

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.
Copy link
Contributor

Build Status

Build successful. APKs to test: https://github.com/fossasia/badgemagic-app/actions/runs/16371716205/artifacts/3572807924.

Screenshots (Android)

Screenshots (iPhone)

Screenshots (iPad)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants