Automate GitHub Issue Assignments with n8n GitHub Trigger

This workflow automates GitHub issue assignment by automatically assigning either the issue creator or commenters based on the issue state and comments, solving delays and confusion in managing open issues on repositories.
githubTrigger
switch
if
+2
Workflow Identifier: 1397
NODES in Use: GitHub Trigger, Switch, IF, NoOp, GitHub

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Harshil, a busy open-source maintainer managing the popular “build-discord-bot” repository on GitHub. Every day, Harshil contends with numerous issues being opened and commented on by contributors eager to help or get their problems addressed. However, managing who is responsible for each issue can be a tedious, time-consuming task. Issues go unassigned for hours, causing delays in responses and confusion among contributors who want to pitch in but don’t know if the issue is taken. Harshil estimates he spends over 3 hours a week just managing issue assignments, which leads to slower development and frustrated community members.

2. What This Automation Does

This n8n workflow is designed to automate the assignment of GitHub issues and comments in the repository. When an issue is opened or a comment is added, the workflow:

  • Detects if an issue is newly opened and unassigned.
  • Automatically assigns the issue creator as the assignee if no assignee is set.
  • Listens for comments where a user asks to be assigned by typing “assign me” (case insensitive and flexible with spacing).
  • If the issue has no current assignee, assigns the commenter who requested the assignment.
  • If the issue is already assigned, comments back to the user to inform them who the current assignee is.
  • Labels the issue with “assigned” when an assignment is made for easy tracking.

By automating this process, Harshil and his team save over 3 hours weekly on issue triage tasks and reduce contributor confusion, speeding up the collaboration and issue resolution process.

3. Prerequisites ⚙️

  • GitHub Account with repository access and a personal access token or OAuth credentials with permissions to read issues and modify assignments.
  • n8n Account for workflow creation and automation running.
  • GitHub OAuth2 Credentials setup in n8n for authentication in the GitHub nodes.
  • Optional: A server or cloud instance if self-hosting your n8n automation (consider Hostinger for hosting).

4. Step-by-Step Guide

Step 1: Create a new workflow in n8n

Log into your n8n dashboard, click on Workflows → New Workflow. You should see a blank canvas titled “Untitled Workflow”.

Step 2: Add the GitHub Trigger node

Click Add Node → Core Nodes → GitHub Trigger.
In the node settings, configure:

  • Owner: Enter the GitHub username owning the repo (e.g., “harshil1712”).
  • Repository: Enter “build-discord-bot”.
  • Events: Select issues and issue_comment so the workflow triggers when issues or comments are created.
  • Authentication: Choose the OAuth2 credential configured to access your GitHub account.

You should see a webhook URL generated. Copy this; you’ll use it to configure GitHub webhooks.

Common mistake: Not selecting both events will prevent the workflow from tracking all necessary triggers.

Step 3: Set up GitHub webhook to listen to issue and comment events

In your GitHub repository, navigate to:

Settings → Webhooks → Add webhook

Paste the webhook URL from the GitHub Trigger node, set content type to application/json, and select only the Issues and Issue comments events. Save the webhook.

This setup is crucial to get data flowing into your n8n workflow.

Step 4: Add a Switch node to check issue event type

Add a Switch node to differentiate issue events such as “opened” or “created”.
Configure the rules by checking {{$json["body"]["action"]}} equals “opened” or “created” so it filters events that should trigger assignments.

Errors here often come from incorrect JSON path expressions; verify the payload structure in GitHub to match.

Step 5: Add IF node to check if the issue has no assignees and body asks for assignment

Use an IF node named “IF no assignee?” configured with two conditions:

  • Checks if assignees array length equals zero.
  • Uses a regex test on the issue body to find keywords like “assign me” (case insensitive).

This combination ensures automatic assignment only if the issue is unassigned and has the appropriate request.

Step 6: Add IF node to check if a comment contains assignment request

Add another IF node “IF wants to work?” to examine comments for the phrase “assign me” using regex, case insensitive.

Step 7: Add IF node to check if the issue has no current assignees before assigning commenter

Add an IF node “IF not assigned?” to check if the assignees array length is zero, ensuring no double assignment.

Step 8: Add GitHub node to assign the issue creator

Add a GitHub node named “Assign Issue Creator”.
Set operation to edit, and configure to assign the issue creator (extracted from $json.body.issue.user.login) and add label “assigned”.
Use dynamic expressions such as {{$node["Switch"].json["body"]["repository"]["owner"]["login"]}} for owner and similar for repository and issue number.

Step 9: Add GitHub node to assign the commenter

Add a GitHub node called “Assign Commenter”.
Similar to the previous node, assign the commenter ($json.body.comment.user.login) and add label “assigned” if the issue is unassigned.

Step 10: Add GitHub node to add a comment if the issue is already assigned

Add a GitHub node named “Add Comment”.
Configure it to post a comment @mentioning the user who requested assignment, informing them who the current assignee is.

Step 11: Add NoOp nodes where no action is needed

Add NoOp nodes at logical breaks to stop the workflow from proceeding when no assignment conditions are met.

Step 12: Connect all nodes as per the logic described

Use connections in n8n to wire the nodes according to the workflow JSON, ensuring the triggers flow through Switch → IF nodes → GitHub nodes or NoOps as designed.

5. Customizations ✏️

  • Change assignment trigger phrase: In the “IF wants to work?” node, update the regex pattern from /[a,A]ssign[w*s*]*me/gm to any custom phrase like “count me in” to match your team’s language.
  • Add more GitHub events: In the GitHub Trigger node, add other relevant events like “pull_request” to extend automation beyond issues.
  • Auto-assign based on labels: Insert a Switch node that checks issue labels and assigns specific team members automatically depending on the label.
  • Custom commenting behavior: Modify the Add Comment node message to include links to your contribution guidelines or thank-you notes.
  • Notification integration: Add a Slack or Discord node to notify your team instantly when an issue is assigned or a commenter requests assignment.

6. Troubleshooting 🔧

Problem: “No events triggered when issues/comments created.”
Cause: Incorrect webhook URL or missing events in GitHub webhook settings.
Solution: Verify webhook URL copied from n8n and ensure “Issues” and “Issue comments” are selected in GitHub webhook settings.

Problem: “Assignment not updating despite triggering workflow.”
Cause: Insufficient GitHub OAuth permissions or incorrect dynamic expressions.
Solution: Recheck OAuth token scopes (repo permissions), validate expressions for owner, repo, issue number in GitHub nodes.

Problem: “Regex check not assigning as expected.”
Cause: Regex pattern mismatch or case sensitivity.
Solution: Test regex independently, adjust patterns, add ‘i’ flag for case insensitivity if needed.

7. Pre-Production Checklist ✅

  • Confirm GitHub OAuth2 credentials are valid and tested.
  • Test the webhook URL manually by creating a test issue or comment.
  • Validate all node expressions and connections in n8n.
  • Ensure your GitHub repository webhooks are active and events deliver payloads.

8. Deployment Guide

Once everything is tested, activate the workflow by toggling it “Active” in n8n. Monitor workflow executions from the n8n dashboard to ensure triggers work as expected.

Consider setting up alerting or logging nodes if your team wants detailed activity records.

9. FAQs

Q: Can I replace the GitHub trigger with a polling method?
A: Polling is less efficient and slower. Using the GitHub Trigger node with webhooks provides real-time, event-driven automation.

Q: Does this workflow consume GitHub API rate limits?
A: Yes, each assignment and comment call uses API requests, so monitor your usage, especially for large repos.

Q: Can I customize the “assign me” phrase?
A: Yes, update the regex in the IF nodes to match your desired phrases.

10. Conclusion

By following this guide, you’ve automated GitHub issue assignments for the “build-discord-bot” repo, saving hours weekly and reducing confusion on who’s working on what. This customized n8n workflow smartly assigns issues to their creators or volunteers, speeding up collaboration.

Next, consider automating pull request reviews, notifications to Slack for assigned issues, or integrating project boards updates for seamless repo management. Happy automating!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free