Overview
Build an n8n workflow that checks a repository for new pull requests on a schedule, has an AI agent read each diff and draft a review comment, and posts it only after a reviewer approves in Slack.
Problem or Objective
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- GitHub · Slack
- Prerequisites
- An n8n instance, GitHub credentials with access to the repository, an API key for a chat model, and a Slack workspace for approvals. The workflow must be saved and published for the schedule to run.
How It Works
In n8n, add GitHub credentials for an account with access to the repository. Start the workflow with a Schedule Trigger that runs every 15 minutes during working hours. Use the GitHub node to get the repository's open pull requests, keep only those not yet reviewed (store reviewed numbers in a sheet or table), and fetch each one's diff with the GitHub node's Get Diff operation. Pass the diff to an AI Agent node with a chat model and your review checklist (likely bugs, missing tests, unclear names, possible secrets). Connect a GitHub tool that creates a pull request comment, and put that tool behind a human review step with Slack as the approval channel. A reviewer sees the proposed comment and approves or denies it; only approved comments are posted. Labels, approvals and merges stay with people. Try it on a sandbox repository first, then save and publish the workflow so the schedule runs.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up n8n.
- Connect the toolsConnect the tools this workflow relies on: GitHub, Slack.
- Check the prerequisitesAn n8n instance, GitHub credentials with access to the repository, an API key for a chat model, and a Slack workspace for approvals. The workflow must be saved and published for the schedule to run.
- Gather your detailsCollect what the prompt asks for: Repository name, Maximum points per comment, Team conventions to check, Largest diff to review in full, Pull request diff.
- Run the starter promptPaste the starter prompt below into n8n and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at docs.n8n.io before you rely on it.
Practical Starter Prompt: Review this pull request diff
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
You review pull requests for [Repository name]. Read the diff below and draft one review comment with at most [Maximum points per comment] points, each naming the file and line, covering likely bugs, missing tests, unclear names and anything that looks like a secret or security risk. Follow our conventions: [Team conventions to check]. If the diff is longer than [Largest diff to review in full] lines, say so and review only the most important files. Use the GitHub comment tool once per pull request; a person approves the comment before it is posted. Never approve, label or merge. Diff: [Pull request diff]Put the comment tool behind human review so a person approves every comment before it is posted. Test on a sandbox repository first, and keep labels, approvals and merges with people.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. n8n's pages document a Schedule Trigger for fixed intervals, a GitHub node that covers pull requests and can serve as an AI agent tool, an AI Agent node that needs at least one connected tool, and human review that pauses the workflow until a person approves a tool call through a channel such as Slack. No cited page measures how useful model-written review comments are, so treat them as suggestions for the human reviewer.
Limitations and Considerations
Each comment waits for a person's approval in Slack before it reaches the pull request, and the workflow never approves, labels or merges. The diff goes to the model provider you connect, so check your organisation's policy before sending private code and leave out files that hold secrets. Give the GitHub credential only the access needed to read pull requests and comment. Check your model provider's pricing before running it on large diffs. The Schedule Trigger page says the workflow must be saved and published for the schedule to run. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Official Website
The official site of the main tool or project in this use case.
Related Videos
About n8n-io/n8n
Give Your Agent Tools (n8n Agents Course 5/7) (opens in a new tab)
Walkthrough of n8n by n8n: it is on the project’s own channel.
Watch on YouTube (opens in a new tab)About n8n-io/n8n
n8n AI Nodes: Connect OpenAI, Claude, and Local Models (opens in a new tab)
Walkthrough of n8n by AI Daily Lab: its description links the GitHub repository.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Schedule Trigger | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 25 Nov 2026, 12:10 UTC
What this source supports
- Use the Schedule Trigger node to run workflows at fixed intervals and times.
- GitHub | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 27 Nov 2026, 07:14 UTC
What this source supports
- Use the GitHub node to automate work in GitHub, and integrate GitHub with other applications.
- This node can be used to enhance the capabilities of an AI agent.
- AI Agent | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 26 Nov 2026, 17:27 UTC
What this source supports
- Connect a chat model and one or more tools, and the agent decides which tools to call to complete a task.
- Human-in-the-loop for tools | Build | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 26 Nov 2026, 17:35 UTC
What this source supports
- You can require human approval before an AI Agent executes a specific tool.

