Auto-merge GitLab merge requests once checks pass

Checks a merge request's approvals and pipeline status, then merges it automatically when everything passes.

How the work actually flows

It branches. Exactly one path is taken.

Pattern: Exclusive Choice (4)

flowchart TD trig(["scheduled merge readiness check"]):::trigtime s0["fetch approval status"]:::svc s1["fetch pipeline status"]:::svc trig --> s0 s0 --> s1 gx{"× approvals and pipeline pass"}:::gate s1 --> gx p00["merge branch automatically"]:::task gx -->|"checks pass"| p00 p10["leave request open"]:::task gx -->|"checks fail"| p10 p00 --> out p10 --> out out[/"merge request automatically merged"/]:::out pay{{"no manual merge delay"}}:::pay out --> pay classDef task fill:#e7f6fe,stroke:#34b8f0,color:#2c2a29 classDef svc fill:#f6f8fa,stroke:#7c8795,color:#2c2a29 classDef mi fill:#e7f6fe,stroke:#0079a8,color:#2c2a29,stroke-width:2px classDef human fill:#fff,stroke:#0079a8,color:#0079a8 classDef store fill:#f6f8fa,stroke:#0079a8,color:#2c2a29 classDef trig fill:#00a4eb,stroke:#0079a8,color:#fff,font-weight:bold classDef trigtime fill:#00a4eb,stroke:#0079a8,color:#fff,font-weight:bold classDef trigdata fill:#8ad4f5,stroke:#0079a8,color:#06314c,font-weight:bold classDef gate fill:#fff,stroke:#e8a23d,color:#6b4708,font-weight:bold classDef out fill:#1f9d6b,stroke:#167a53,color:#fff,font-weight:bold classDef pay fill:#06314c,stroke:#021f33,color:#fff
Starts itAn outside serviceOne path onlyResultPayoff
Build size
Standard

A mid-size build with several tools working together.

Business functions
DevOps & IT Operations
Connects
GitLab

The problem it solves

Merging a branch should be quick once it is approved and the pipeline is green, but someone still has to notice it is ready and click merge. That small delay adds up across a busy team and stalls work waiting behind it.

Who it fits

A development or DevOps team that wants approved, passing merge requests merged without manual follow-up.

How it works

  1. A scheduled check or an event in GitLab starts the process
  2. The automation fetches the merge request's approval and pipeline status
  3. It confirms the request has the required approvals and a passing pipeline
  4. If everything checks out, it merges the branch automatically through the GitLab API
What you get

Merge requests that go in the moment they're ready

Merge requests get merged automatically the moment they have approval and a passing pipeline.

What you get

An automatically merged branch, with no manual review of ready-to-merge requests needed.

What you need

A GitLab account with a personal access token.

We can build this. But should you?

The hard question is not how to build it. It is whether this is the right thing to build first.

That is what a Fractional Chief AI Officer figures out with you, before anyone writes a line of code.

Let's Talk Strategy

Related automations

Back to the AI Playbook