← All N8N workflows
AI & researchAgentCodeGithubGithub TriggerGoogle Sheets Tool

Code Review workflow

Configured with Agent, Github, Github Trigger, Google Sheets Tool, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
AI & modelsOpenAI Chat ModelOpenAI Chat ModelTriggerPR TriggerGithub TriggerWeb / APIGet file's Diffs fromPRHTTP RequestCodeCreate target Promptfrom PR DiffsCodeIntegrationGitHub RobotGithubIntegrationAdd Label to PRGithubData storeCode Best PracticesGoogle Sheets ToolAI & modelsCode Review AgentAgent

Node categories in this workflow

  • AI & models
  • Trigger
  • Web / API
  • Code
  • Integration
  • Data store

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
PR TriggerTriggerGithub TriggerSee node parameters
Get file's Diffs from PRWeb / APIHTTP RequestSee node parameters
Create target Prompt from PR DiffsCodeCodeSee node parameters
GitHub RobotIntegrationGithubreview
Add Label to PRIntegrationGithubedit
Code Best PracticesData storeGoogle Sheets ToolSee node parameters
Code Review AgentAI & modelsAgentSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • githubApi
  • githubOAuth2Api
  • googleSheetsOAuth2Api
  • openAiApi

Workflow notes

Sticky Note

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.

Sticky Note1

2-Get PR Diffs The 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 dynamically based on the trigger payload.

https://api.github.com/repos/{{$json.body.sender.login}}/{{$json.body.repository.name}}/pulls/{{$json.body.number}}/files

Sticky Note2

3-Create Prompt from diffs This Code node runs a JavaScript snippet to: -Parse file diffs from the previous HTTP Request node -Format each diff with its file name -Build a structured natural language prompt for the AI agent

The final output is a clear, contextual instruction like: "You are a senior iOS developer. Please review the following code changes in these files..."

Sticky Note3

Github Comment Poster Posts the AI-generated review as a comment on the pull request using GitHub API.

Sticky Note4

PR Labeler (optional) Automatically adds a label like ReviewedByAI to the pull request once the AI comment is posted.

Sticky Note5

Google Sheet Best Practices Enables the AI agent to reference to your team coding guidelines stored in a Google Sheet for more accurate and opinionated reviews. You can replace Google Sheets with any other database or tool.

Code Review workflow

Code Review workflow

Purpose and structure

This folder contains the Code Review workflow workflow. Its executable nodes use agent, code, github, githubTrigger, googleSheetsTool, httpRequest, lmChatOpenAi. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

PR Trigger

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/1292_Code_GitHub_Automate_Webhook.json MIT; preserve source notices.

More in AI & research