{
  "name": "Automated PR code reviews with GitHub, GPT-4, and Google Sheets best practices",
  "nodes": [
    {
      "id": "62ef8e9f-df1a-46dd-b025-a206ac888f97",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -100,
        140
      ]
    },
    {
      "id": "35361983-8c66-457e-8cb6-7585a18f8aaf",
      "name": "PR Trigger",
      "type": "n8n-nodes-base.githubTrigger",
      "position": [
        -740,
        -80
      ]
    },
    {
      "id": "25d17a0d-c409-406d-bd97-00ec71261c16",
      "name": "Get file's Diffs from PR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -520,
        -80
      ]
    },
    {
      "id": "f984f872-c4b0-4752-bc54-1f311fa36feb",
      "name": "Create target Prompt from PR Diffs",
      "type": "n8n-nodes-base.code",
      "position": [
        -300,
        -80
      ]
    },
    {
      "id": "0d9790b1-9818-4e73-a202-57d4db039b35",
      "name": "GitHub Robot",
      "type": "n8n-nodes-base.github",
      "position": [
        296,
        -80
      ]
    },
    {
      "id": "234c235c-a88d-412b-b7b1-f9f0cc8eead9",
      "name": "Add Label to PR",
      "type": "n8n-nodes-base.github",
      "position": [
        516,
        -80
      ]
    },
    {
      "id": "34d9842f-928e-4d19-9d91-336c85f53485",
      "name": "Code Best Practices",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        68,
        140
      ]
    },
    {
      "id": "ab6c0b9d-1c76-448c-896e-7fdb15365b72",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -260
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "**1-The GitHub Trigger** node initiates the workflow whenever a pull request event occurs on a specified repository. It enables real-time automation based on GitHub activity.\n"
      }
    },
    {
      "id": "27752afa-4d97-4e23-be58-6171b5e17f1b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        100
      ],
      "parameters": {
        "width": 340,
        "height": 220,
        "content": "**2-Get PR Diffs**\nThe HTTP Request node fetches the list of changed files and their diffs from the pull request that triggered the workflow. It uses the GitHub REST API to retrieve this data dynamica"
      }
    },
    {
      "id": "c201133c-3d54-4fe0-8442-11ff92dcc89e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        -340
      ],
      "parameters": {
        "width": 360,
        "height": 240,
        "content": "**3-Create Prompt from diffs**\nThis Code node runs a JavaScript snippet to:\n-Parse file diffs from the previous HTTP Request node\n-Format each diff with its file name\n-Build a structured natural langu"
      }
    },
    {
      "id": "6f6c78b2-ad75-43fa-a082-9f345f9b5f30",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -260
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "**Github Comment Poster**\nPosts the AI-generated review as a comment on the pull request using GitHub API."
      }
    },
    {
      "id": "ac7b6754-2bef-408d-8f53-fb51ece1673e",
      "name": "Code Review Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -80,
        -80
      ]
    },
    {
      "id": "30655e04-f429-40bb-b6b7-9a11ffa4e607",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -220
      ],
      "parameters": {
        "width": null,
        "height": 120,
        "content": "**PR Labeler (optional)**\nAutomatically adds a label like *ReviewedByAI* to the pull request once the AI comment is posted."
      }
    },
    {
      "id": "76fbb269-e7ce-4d8a-a609-a5ab454258d8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        120
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "**Google Sheet Best Practices**\nEnables the AI agent to reference to your team coding guidelines stored in a Google Sheet for more accurate and opinionated reviews.\nYou can replace Google Sheets with "
      }
    }
  ],
  "connections": {
    "PR Trigger": {
      "main": [
        [
          {
            "node": "Get file's Diffs from PR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub Robot": {
      "main": [
        [
          {
            "node": "Add Label to PR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code Review Agent": {
      "main": [
        [
          {
            "node": "GitHub Robot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Code Review Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code Best Practices": {
      "ai_tool": [
        [
          {
            "node": "Code Review Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get file's Diffs from PR": {
      "main": [
        [
          {
            "node": "Create target Prompt from PR Diffs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create target Prompt from PR Diffs": {
      "main": [
        [
          {
            "node": "Code Review Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}