Assign GitHub PR reviewers by code ownership with Supabase and Slack
Quick overview This workflow receives GitHub pull request webhooks, looks up changed files and a Supabase-based reviewer ownership roster, selects the least recently assigned matching reviewers, requests them as reviewers on GitHub, and sends each selected reviewer a direct message in Slack.
How it works Receives a GitHub pull request webhook via an n8n webhook endpoint. Extracts PR details and only continues for newly opened, non-draft PRs that are not authored by bots. Fetches the PR’s changed file list from the GitHub REST API and loads the reviewer roster (GitHub username, Slack user ID, owned path prefixes, last assigned time) from Supabase. Matches changed file paths to reviewers’ owned path prefixes, excludes the PR author, sorts candidates by least recently assigned, and selects up to the configured maximum number of reviewers. If reviewers are found, requests them as reviewers on the PR using the GitHub API. Sends each selected reviewer a Slack DM with the PR title, author, and link, then updates the reviewer’s last_assigned_at field in Supabase for load balancing.
Setup Create a GitHub webhook for your repository that posts pull_request events to this workflow’s webhook URL. Provide a GitHub personal access token with permission to request reviewers, and set the repo owner/name and max reviewer count in the configuration values. Add a Supabase credential, create a reviewers table with fields for github_username, slack_user_id, owned_paths, and last_assigned_at, and update the table names if you don’t use the defaults. Add a Slack credential and ensure each reviewer’s Slack user ID is populated in Supabase so the workflow can send DMs.
Related Templates
AI Weather Forecasts with MCP Integration
Real-time Weather Forecasts with MCP Tools This n8n workflow demonstrates how to integrate real-time weather intelligen...
Google Sheets UI for n8n Workflow
Google Sheets UI for Workflow Control This n8n template provides a practical and efficient way to manage your n8n workf...
Demo Workflow - How to use workflowStaticData()
This workflow demonstrates how to use the workflowStaticData() function to set any type of variable that will persist wi...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments