FlowKit

Connecting GitLab to n8n: automate issues, merge requests and pipelines

Published 1 August 2026 · 6 min read

GitLab already ships its own CI/CD, boards and webhooks — for everything that happens inside GitLab. But as soon as information needs to leave it (pinging the team on Slack when a pipeline breaks, triaging incoming issues with an LLM, feeding a project board or a weekly digest), you end up bending .gitlab-ci.yml into a business-orchestration tool, which is exactly what n8n was built for instead. This guide covers token authentication, the GitLab node's actual operations, the GitLab Trigger and its twelve events, then three concrete automations — including AI issue triage and a pipeline alert enriched with an AI summary of the error log.

It is the GitLab counterpart of our GitHub automation guide for n8n, with one major difference: GitLab is commonly self-hosted, and pairing self-hosted GitLab with self-hosted n8n keeps all of your code and automations on your own infrastructure.

Authentication: personal access token and the Server URL field

The n8n GitLab credential offers two methods: API Access Token and OAuth2.

For a typical backend use case, the personal access token is the default choice:

  1. In GitLab: avatar → Edit profileAccess tokensAdd new token;
  2. Pick the scopes: api covers all of the node's functionality (read-write). For a workflow that only reads, read_api or read_repository shrink the exposure surface;
  3. Set an expiration date and write it down somewhere — a token that dies silently is the most annoying outage to diagnose;
  4. In n8n: GitLab API credential, two fields — Server URL and the token.

The Server URL field is the key to the self-hosted angle: enter https://gitlab.com for the SaaS, or your instance's URL (https://gitlab.yourdomain.com) for a self-hosted installation. Nothing else changes: node and trigger behave identically. If you host both GitLab and n8n yourself, source code, issues and automation workflows all stay on your servers — a consistency argument for teams that already settled the self-hosted vs cloud debate for n8n on the sovereignty side. Either way, the token lives in n8n's encrypted credentials: the rules from our API credential security guide apply.

OAuth2 (creating an Application in GitLab, Client ID + Secret) is best reserved for cases where each user connects their own account.

The GitLab node's operations

The node covers five resources — narrower than the GitHub node, which is worth knowing upfront:

  • Issue: Create, Get, Edit (title, description, labels, assignees, state), Lock, Create Comment — the raw material of triage;
  • File: Create, Get, Edit, Delete, List — every write produces a commit, the building block for automatically backing up your n8n workflows to Git if your remote is GitLab;
  • Release: Create, Get, Get All, Update, Delete — to generate and publish release notes;
  • Repository: Get (project metadata) and Get Issues (the repository's issues, with filters);
  • User: Get Repositories — a given user's projects.

One notable gap: no write operations on merge requests. The GitLab Trigger does receive MR events (see below), but to create, comment on, approve or merge a merge request, you need an HTTP Request node against GitLab's REST API (/projects/:id/merge_requests), with the same token in a PRIVATE-TOKEN header. Same story for pipelines (retrying a job, downloading a log): the REST API is the natural extension of the node.

GET https://gitlab.yourdomain.com/api/v4/projects/42/jobs/{{ $json.build_id }}/trace
Header: PRIVATE-TOKEN = {{ your Header Auth credential }}

The GitLab Trigger: twelve real-time events

The GitLab Trigger automatically registers a webhook on the project when the workflow is activated, for the events you tick: Push, Issue, Merge Request, Pipeline, Job, Tag, Release, Comment, Deployments, Wiki page, plus the confidential variants (Confidential Issues, Confidential Comments). GitLab pushes each event immediately, with a rich payload: object_kind tells you the event type, object_attributes carries the details (pipeline status, issue action, an MR's source and target branches, and so on).

Two things to watch. First, your n8n instance must be reachable by GitLab: over public HTTPS for gitlab.com, or simply on the same private network if GitLab and n8n both run on your infrastructure. Second, the trigger forwards every event of the selected type: a Pipeline event fires on every status change (pending, running, success, failed). An IF node right after the trigger does the sorting:

{{ $json.object_attributes.status === "failed" }}

Three high-yield automations

1. AI triage of incoming issues

GitLab Trigger on the Issue event → an IF keeps only object_attributes.action === "open" → an AI Agent node (see our AI Agent node guide) reads title and description, proposes labels (bug, feature, question) and a priority, and spots missing information → the GitLab node (Issue → Edit) applies the labels, then (Issue → Create Comment) politely asks for version and reproduction steps when they are missing.

That last step is no gimmick: the study by Nicolas Bettenburg, Thomas Zimmermann and their co-authors, "What Makes a Good Bug Report?" (FSE 2008, see on Google Scholar), based on 466 responses from Apache, Eclipse and Mozilla developers, exposed a systematic mismatch between what developers need (reproduction steps, stack traces, test cases) and what reporters spontaneously provide. An agent that requests those elements the moment an issue is opened closes exactly that gap, before the issue goes stale in the queue.

2. Enriched Slack alert on failed pipelines

GitLab Trigger on Pipeline → IF on status === "failed" → an HTTP Request fetches the failed job's log via the API (/jobs/:id/trace) → an LLM distills it into a three-line summary: the stage that broke, the likely error, the first lead → a Slack node posts it all with a direct link to the pipeline, the branch and the commit author (our AI Slack bot guide covers the formatting).

The stakes are real: the analysis by Moritz Beller, Georgios Gousios and Andy Zaidman, "Oops, My Tests Broke the Build" (MSR 2017, see on Google Scholar), covering more than 2.6 million CI builds from GitHub projects, showed that failing tests are the number one cause of broken builds. In other words, failed pipelines are frequent and deserve better than a generic notification: a summary that says what broke saves the first fifteen minutes of diagnosis. The same pattern applies to application errors with our AI-powered Sentry alert triage.

3. Syncing issues to a board or a weekly digest

Two variants depending on how your team works. Real time: GitLab Trigger on Issue → create or update the matching ticket in Jira or your project management tool, with n8n keeping an ID mapping to avoid duplicates. Batched: a weekly Schedule Trigger → GitLab (Repository → Get Issues) fetches open issues → an LLM groups them by theme and flags issues without a reply for more than seven days → digest posted to Slack or emailed every Monday morning.

Best practices and limitations

  • Filter early: the Pipeline trigger fires on every status transition, the Push trigger on every push — an IF at the top of the workflow avoids pointless executions.
  • Watch out for loops: a workflow that commits (File resource) to the repository it watches via Push re-triggers itself. Filter on the commit author or a marker in the message.
  • MRs go through the REST API: do not look for a Merge Request operation in the node, it is not there — HTTP Request with PRIVATE-TOKEN.
  • Test your workflows like code: since they touch the repository, version them and validate them in CI, as described in our guide to validating n8n workflows in continuous integration — the approach transposes as-is to GitLab CI.
  • Self-hosted on both sides: self-hosted GitLab + self-hosted n8n on the same private network avoids exposing the webhook to the Internet and keeps code and automations in-house.

Key takeaways

A personal access token with the api scope (or read_api for read-only), the Server URL field to point at gitlab.com or your own instance, the GitLab Trigger to react in real time to pushes, issues, merge requests and pipelines, and the Issue/File/Release/Repository resources to act — with HTTP Request filling in the missing merge request operations. Start with AI issue triage and the enriched pipeline alert: two one-hour workflows that get information out of GitLab at the exact moment it is worth something.

FAQ

Frequently asked questions

Does the n8n GitLab node work with a self-hosted GitLab instance?

Yes. The n8n GitLab credential includes a Server URL field: enter https://gitlab.com for the SaaS version or the URL of your self-hosted instance (https://gitlab.yourdomain.com). Every node operation and the GitLab Trigger then work exactly the same way, as long as n8n can reach the instance over the network.

Which scopes should a GitLab personal access token have for n8n?

The api scope covers all of the node's functionality (read and write on issues, files, releases, webhooks). For a read-only workflow, read_api or read_repository are enough and limit the blast radius if the token leaks. Set an expiration date and store the token only in n8n's encrypted credentials.

Can the GitLab node create or merge merge requests?

No: the node covers the Issue, File, Release, Repository and User resources, but has no write operations for merge requests. The GitLab Trigger does receive merge request events in real time, though. To create, comment on or merge an MR, use an HTTP Request node against GitLab's REST API with the same token.

How do I trigger an n8n workflow when a GitLab pipeline fails?

Enable the Pipeline event in the GitLab Trigger: GitLab sends a webhook on every pipeline status change. Then add an IF node that only lets through payloads where object_attributes.status equals failed, so you ignore running, pending and success statuses.

Bundle FlowKit Complet

€269