AI Workflow for GitHub PR Notifications
Difficulty: Beginner · Setup time: 20 min · Steps: 4
Developers miss PR reviews because notifications get buried in email, and tickets stay open long after the code that closes them is merged. This workflow routes every GitHub PR event to the right Slack channel with a direct @mention of the requested reviewer, and automatically closes the linked Linear issue when the PR merges.
What to Expect
- < 2 hr — average PR review time vs. 8+ hours without Slack notifications
- 100% — of merged PRs automatically close their linked Linear issues
Tools Used in This Workflow
How It Works — Step by Step
-
Step 1: GitHub PR events via webhook
Tool: GitHub
GitHub sends webhooks to n8n for PR events: opened, review_requested, approved, changes_requested, and merged. Each event type triggers a different branch of the workflow with the appropriate notification and action.
-
Step 2: Route events in n8n
Tool: n8n
n8n's Switch node branches on the event type — PR opened goes to the team channel, review_requested DMs the specific reviewer, approved notifies the author, and merged triggers the Linear ticket closure branch.
-
Step 3: Notify in Slack with reviewer mention
Tool: Slack
Review request messages in Slack @mention the specific reviewer by mapping their GitHub username to their Slack user ID. The message includes the PR title, a 2-line description, changed files count, and a direct link to the diff in GitHub.
-
Step 4: Auto-close Linear issue on merge
Tool: Linear
When a PR is merged, n8n reads the PR description for a Linear issue number (e.g., 'Closes LIN-123'), calls the Linear API to move that issue to Done, and posts a comment on the Linear issue with the merged PR link for full traceability.
Pro Tips for This Workflow
- Create a GitHub username → Slack user ID mapping table in Airtable or a simple n8n JSON object — this enables direct @mentions of the right person in every review request notification.
- Add a PR size label ('XS', 'S', 'M', 'L', 'XL') based on lines changed and include it in the Slack message — reviewers use it to prioritize which PRs to tackle first.
- Use n8n's 'Wait' node to detect PRs that have been open without a review for more than 24 hours and send a gentle reminder — prevents PRs from stalling undetected.
What You'll Need
- GitHub account — PR events webhook
- n8n account — Event routing
- Slack account — Reviewer notifications
- Linear account — Auto-close linked issue
- Basic automation experience, or a vetted expert to build it for you
Related Video Tutorial
Frequently Asked Questions
- How do I create the GitHub → Slack username mapping?
The simplest approach is a hardcoded JSON object in n8n: {"github_handle": "slack_user_id"}. Get Slack user IDs from Slack's workspace member list or the People & Groups API. For large teams, store the mapping in an Airtable table and look up the Slack ID dynamically during the workflow.
- Does this workflow require GitHub Enterprise or does it work with free GitHub?
This workflow works with any GitHub plan including the free tier. The PR events webhook, which is the trigger for this workflow, is available for all repositories including public and private repos on free accounts. n8n self-hosted or cloud can receive these webhooks.
- How does n8n read the Linear issue number from a PR description?
Add an n8n 'Extract String' step using a regex like /LIN-\d+/ or /Closes\s+([A-Z]+-\d+)/i applied to the PR body text. This captures the issue identifier which is then passed to the Linear API's updateIssue mutation to move it to Done.
- Can I add this workflow for GitLab instead of GitHub?
Yes — GitLab has equivalent Merge Request webhooks for opened, approved, merged, and commented events. Replace the GitHub webhook trigger in n8n with a GitLab webhook trigger. The Slack and Linear steps are identical; only the webhook payload structure differs slightly (merge_request instead of pull_request).
Want This Workflow Built for You?
Our vetted automation engineers can set up this exact workflow in days — customized to your tools and process. Free consultation, honest quote, fast delivery.
Get matched free — no commitmentMore Team & Project Management workflows | All workflow guides | Find automation experts