Skip to main content

Automate code reviews for GitLab MRs with Gemini AI and JIRA context

Workflow preview

Workflow preview
100%
Automate code reviews for GitLab MRs with Gemini AI and JIRA context preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

What it does Automates code review by listening for a comment trigger on GitLab merge requests, summarising the diff, and using an LLM to post constructive, line‑specific feedback. If a JIRA ticket...

Best for

  • AI Summarization automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.if, @n8n/n8n-nodes-langchain.chainllm, @n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.code, n8n-nodes-base.jira, n8n-nodes-base.set, n8n-nodes-base.merge, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Evgeny Agronsky.

Original n8n.io source

1.1 Workflow description

Title
Automate code reviews for GitLab MRs with Gemini AI and JIRA context
Workflow name
Automate code reviews for GitLab MRs with Gemini AI and JIRA context

What it does

Automates code review by listening for a comment trigger on GitLab merge requests, summarising the diff, and using an LLM to post constructive, line‑specific feedback. If a JIRA ticket ID is found in the MR description, the ticket’s summary is used to inform the AI review.

Use cases

  • Quickly obtain high‑quality feedback on MRs without waiting for peers.
  • Highlight logic, security or performance issues that might slip through cursory reviews.
  • Incorporate project context by pulling in related JIRA ticket summaries.

Good to know

  • Triggered by commenting ai-review on a merge request.
  • The LLM returns only high‑value findings; if nothing critical is detected, the workflow posts an “all clear” message.
  • You can swap out the LLM (Gemini, OpenAI, etc.) or adjust the prompt to fit your team’s guidelines.
  • AI usage may incur costs or be geo‑restricted depending on your provider n8n.io.

How it works

  • Webhook listener: A Webhook node captures GitLab note events and filters for the trigger phrase.

  • Fetch & parse: The workflow retrieves MR details and diffs, splitting each change into “original” and “new” code blocks.

  • Optional JIRA context: If your MR description includes a JIRA key (e.g., PROJ-123), the workflow fetches the ticket (and parent ticket for subtasks) and composes a brief context summary.

  • LLM review: The parsed diff and optional context are sent to an LLM with instructions to identify logic, security or performance issues and suggest improvements.

  • Post results: Inline comments are posted back to the MR at the appropriate file/line positions; if no issues are found, a single “all clear” note is posted.

How to use

  • Import the template JSON and open the Webhook node. Replace the REPLACE_WITH_UNIQUE_PATH placeholder with your desired path and configure a GitLab project webhook to send MR comments to that URL.
  • Select your LLM credentials in the Gemini (or other LLM) node, and optionally add JIRA credentials in the JIRA nodes.
  • Activate the workflow and comment ai-review on any merge request to test it.
  • For each review, the workflow posts status updates (“AI review initiated…”) and final comments.

Requirements

  • A GitLab project with a generate Personal Access Token (PAT) stored as an environment variable (GITLAB_TOKEN).
  • LLM credentials (e.g., Google Gemini) and optional JIRA credentials.

Customising this workflow

  • Change the trigger phrase in the Trigger Phrase Filter node.
  • Modify the LLM prompt to focus on different aspects (e.g., style, documentation).
  • Filter out certain file types or directories before sending diffs to the LLM.
  • Integrate other services (Slack, email) to notify teams when reviews are complete.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Need Review

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 2 - Skip File Changes

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 3 - Basic LLM Chain

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 4 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 5 - Extract the JIRA Issue ID

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Get JIRA issue

Type / Role
n8n-nodes-base.jira - jira
Config choices
Version 1

Block 7 - Format JIRA Context

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Extract MR Details

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - If JIRA Subtask

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 10 - Get JIRA Parent Issue

Type / Role
n8n-nodes-base.jira - jira
Config choices
Version 1

Block 11 - Format JIRA Parent Context

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 13 - Get MR Changes

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 14 - Prepare Code Changes

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - Error Trigger

Type / Role
n8n-nodes-base.errorTrigger - errorTrigger
Config choices
Version 1

Block 16 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 17 - Merge LLM Output with Input

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 18 - Filter Irrelevant Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 19 - Any Issues Found?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 20 - Split Out Changes

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 21 - Split Out Comments

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 22 - Prepare Request

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 23 - Prepare Request Without Position

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 24 - Set workflow execution information

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Showing the first 24 of 41 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automate code reviews for GitLab MRs with Gemini AI and JIRA context
Complexity advanced
Nodes 41
Categories AI Summarization, Multimodal AI
Author Evgeny Agronsky
Published 26 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7924/7924.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate code reviews for GitLab MRs with Gemini AI and JIRA context do?

What it does Automates code review by listening for a comment trigger on GitLab merge requests, summarising the diff, and using an LLM to post constructive, line‑specific feedback. If a JIRA ticket...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI Summarization, Multimodal AI use case.