Assign GitHub PR reviewers by file ownership with Supabase and Slack

Go to Workflow
0 views
Built by Kanishka Shrivastava Kanishka Shrivastava
Created on October 17, 2026

Description

Quick Overview
This workflow listens for GitHub pull request webhooks, looks up changed files and a reviewer roster in Supabase, selects matching reviewers based on file path ownership and last assignment time, then requests reviews in GitHub and notifies the reviewers in Slack.

How it works
Receives a GitHub pull request webhook request.
Extracts key PR details and filters to only process newly opened, non-draft PRs that are not created by bot accounts.
Fetches the pull request’s changed files from the GitHub API and retrieves the full reviewer roster from Supabase.
Matches changed file paths against each reviewer’s owned paths, excludes the PR author, and selects up to the configured maximum reviewers prioritizing those least recently assigned.
Requests the selected reviewers on the pull request via the GitHub API.
Sends each selected reviewer a direct Slack message with the PR title, author, and link, then updates their last-assigned timestamp in Supabase.
If no matching reviewers are found, ends without assigning reviewers and records the “no reviewers” branch internally.

Setup
Create a GitHub webhook for pull request events and point it to this workflow’s webhook URL (POST to /github-pr-webhook).
Provide a GitHub personal access token (or equivalent) with permission to read PR files and request reviewers, then set github_token, repo_owner, and repo_name in the configuration values.
Connect your Supabase credentials and ensure a reviewers table exists with github_username, slack_user_id, owned_paths (comma-separated prefixes), and last_assigned_at fields.
Connect Slack credentials and ensure each reviewer’s slack_user_id is valid for direct messaging.
Adjust max_reviewers and the owned_paths matching rules to fit your repository structure and review policy.

This workflow was created by Kanishka Shrivastava and shared publicly on the n8n community template library. n8nFind indexes it for discovery — the workflow remains the property of its original creator.

Nodes Used (4)

Code
n8n-nodes-base.code
HTTP Request
n8n-nodes-base.httpRequest
Slack
n8n-nodes-base.slack
Supabase
n8n-nodes-base.supabase