⚡ Only 300 spots remaining • Closes in 2d 14h 32m

Back to Workflow Library
Developer Tools

GitHub PR Diff Summarizer AI

Streamline code reviews. Whenever a new Pull Request is opened, this workflow fetches the code diff from GitHub. It feeds the diff into an AI Chat Node (OpenAI/Anthropic) to produce a concise summary, then posts it as a PR comment.

#GitHub
#OpenAI
#AI
#Code Review
#Dev

Automation Logic

n8n JSON Blueprint

This workflow is pre-configured and ready for deployment. Simply import the JSON template into your n8n instance and configure your credentials.

This is an exclusive blueprint. Copy the JSON below to use it.

QUICK DEPLOY

  • 1
    Download the .json file
  • 2
    Open n8n & click "Import"
  • 3
    Configure your API keys

PRO TIP

Always test your workflow in a development environment before pushing to production.

JSON BLUEPRINT

n8n-workflow.json
{
  "nodes": [
    {
      "parameters": {
        "owner": "org-name",
        "repository": "repo-name",
        "events": [
          "pull_request"
        ]
      },
      "name": "GitHub PR Trigger",
      "type": "n8n-nodes-base.githubTrigger",
      "typeVersion": 1,
      "position": [
        100,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://api.github.com/repos/org-name/repo-name/pulls/{{$json.pull_request.number}}",
        "headers": {
          "Accept": "application/vnd.github.v3.diff",
          "Authorization": "token github-pat"
        }
      },
      "name": "Fetch PR Diff",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        300,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "prompt": "=Summarize the following git diff in a bulleted list for a PR reviewer:\n{{$json.body}}"
      },
      "name": "AI Summarizer",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "resource": "issueComment",
        "operation": "create",
        "owner": "org-name",
        "repository": "repo-name",
        "issueId": "={{$node[\"GitHub PR Trigger\"].json.pull_request.number}}",
        "body": "### AI Code Diff Summary:\n{{$json.text}}"
      },
      "name": "Post GitHub Comment",
      "type": "n8n-nodes-base.github",
      "typeVersion": 1,
      "position": [
        700,
        300
      ]
    }
  ],
  "connections": {
    "GitHub PR Trigger": {
      "main": [
        [
          {
            "node": "Fetch PR Diff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch PR Diff": {
      "main": [
        [
          {
            "node": "AI Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Summarizer": {
      "main": [
        [
          {
            "node": "Post GitHub Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

To use this, copy the JSON above and paste it directly onto your n8n canvas.

IMPLEMENTATION GUIDE

Required Nodes

  • GitHub Node
  • OpenAI Node
  • AI Node
  • Code Review Node
  • Dev Node
  • Cron / Webhook Trigger

Core Benefits

  • 100% Automated Execution
  • Reduces Manual Data Entry
  • Infinite Scalability

Need Help Building Your Private Cloud?

Join the elite marketers who have offloaded their entire backend to n8n. Get direct support and custom builds in our private forum.

user