AgentRecipes
Recipes › Engineering & security

How to review GitHub pull requests automatically with an n8n AI agent

Engineering & securityn8n

The problem

Small teams want a first review pass on every pull request, checked against their own coding conventions, before a human looks.

Tools needed

Step-by-step recipe

  1. Add a GitHub Trigger node that fires when a PR is opened.
  2. Call GitHub's pull-request files API with an HTTP Request node to get filenames and diffs.
  3. Merge them into one prompt in a Code node, casting the model as a senior developer for your stack.
  4. Give the agent a Google Sheet of team best practices as a tool.
  5. Post the review as a PR comment and add a label (ReviewedByAI in the source).

Copyable prompt

Prompt template
You are a senior [LANGUAGE/STACK] reviewer. Review this pull request diff against our team rules: {{best_practices}}.
Report at most 5 findings, most important first. For each: file, approximate line, problem, why it matters, suggested fix. Skip style nitpicks a linter would catch. If the PR looks fine, say so in one sentence. Keep the whole review under 250 words.

Diff: {{diff}}

Original template written by AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.

What the builder reported

On a test PR the agent posted a comment and applied the label, but as one general comment rather than line-level feedback. The author found reviews often too verbose and sometimes missing the core problems.

These are the source author's own claims. AgentRecipes has not tested or verified them.

Watch out for

Source

Original write-up: Medium ↗

Found via Agent Use Cases: “Review GitHub pull requests automatically”. This recipe summarises the source in our own words; read the original for the full details. Link last checked 2026-10-15.

More engineering & security recipes

Monitor new CVEs and get AI-scored alerts with n8nSecurity teams need to know quickly when a relevant vulnerability is published, without reading every advisory feed.n8nDiagnose Kubernetes alerts with an n8n agent and MCP serversWhen an alert fires at night, the on-call engineer spends the first minutes gathering context from several dashboards before they can…n8n

New agent recipes in your inbox

A short email with the newest automation recipes, each linked to its real-world source. No spam, unsubscribe anytime.