{
  "name": "GitHub PR Opened \u2192 AI Review Summary \u2192 Slack",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "github-webhook",
        "options": {}
      },
      "id": "github-webhook",
      "name": "GitHub Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        240,
        300
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.action }}",
              "operation": "equals",
              "value2": "opened"
            }
          ]
        }
      },
      "id": "filter-opened",
      "name": "Only PR Opened",
      "type": "n8n-nodes-base.if",
      "position": [
        460,
        300
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "anthropicApi",
        "model": "claude-3-5-haiku-20241022",
        "messages": {
          "values": [
            {
              "content": "=You are a code review assistant. Analyze this GitHub PR and write a 3-bullet summary of what it does, potential risks, and what to check during review.\n\nPR Title: {{ $json.body.pull_request.title }}\nDescription: {{ $json.body.pull_request.body }}\nFiles changed: {{ $json.body.pull_request.changed_files }}\nAdditions: {{ $json.body.pull_request.additions }}\nDeletions: {{ $json.body.pull_request.deletions }}"
            }
          ]
        }
      },
      "id": "ai-summary",
      "name": "AI: Summarize PR",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        680,
        300
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "slackApi",
        "resource": "message",
        "operation": "post",
        "channel": "#engineering",
        "text": "\ud83d\udd0d *New PR: {{ $('GitHub Webhook').item.json.body.pull_request.title }}*\n\nBy: {{ $('GitHub Webhook').item.json.body.pull_request.user.login }}\nURL: {{ $('GitHub Webhook').item.json.body.pull_request.html_url }}\n\n*AI Summary:*\n{{ $json.text }}"
      },
      "id": "slack-notify",
      "name": "Notify #engineering",
      "type": "n8n-nodes-base.slack",
      "position": [
        900,
        300
      ],
      "typeVersion": 2.2
    }
  ],
  "connections": {
    "GitHub Webhook": {
      "main": [
        [
          {
            "node": "Only PR Opened",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only PR Opened": {
      "main": [
        [
          {
            "node": "AI: Summarize PR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: Summarize PR": {
      "main": [
        [
          {
            "node": "Notify #engineering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "_meta": {
    "description": "When a GitHub PR is opened, Claude AI writes a 3-bullet summary and posts it to Slack #engineering \u2014 so reviewers know exactly what to look at.",
    "requiredCredentials": [
      "Anthropic API",
      "Slack API"
    ],
    "category": "Developer / Technical",
    "n8nVersion": ">=1.0.0",
    "setup": "GitHub repo \u2192 Settings \u2192 Webhooks \u2192 add n8n URL, content type: application/json, event: Pull requests"
  }
}