Skip to content
Author with AI

<GitLabMergeRequest>

The <GitLabMergeRequest> block creates a GitLab merge request from changes made during a runbook. It is a GitLab-locked alias of <GitPullRequest>, equivalent to <GitPullRequest provider="gitlab" />, and accepts the same props except provider. The provider is always gitlab, and a provider prop you set is ignored.

<GitLabAuth
id="gl-auth"
title="Connect to GitLab"
/>
<GitClone
id="clone-repo"
gitAuthId="gl-auth"
title="Clone Repository"
prefilledUrl="https://gitlab.com/acme-corp/infrastructure"
/>
<GitLabMergeRequest
id="create-mr"
gitAuthId="gl-auth"
title="Create Merge Request"
prefilledBranchName="upgrade-pipelines-v4"
prefilledCommitMessage="Upgrade Gruntwork Pipelines from v3 to v4 [skip ci]"
prefilledPullRequestTitle="[skip ci] Upgrade Gruntwork Pipelines from v3 to v4"
prefilledPullRequestDescription="Upgrades Pipelines configuration from v3 to v4."
/>

You can pre-populate the MR title, description, labels, branch name, and commit message. Users can still edit these values before creating the MR.

Prop Type Required Description
id string Yes Unique block identifier.
title string No Display title. Defaults to Create Merge Request.
description string No Description text below the title.
autoCollapse boolean No Folds the block down to its title once the merge request is opened. Defaults to false. See Folding done blocks.
gitAuthId string No Reference to a <GitAuth> or <GitLabAuth> block.
inputsId string | string[] No Reference to one or more <Inputs> blocks by ID. The template expressions in the props below can use their values.
prefilledPullRequestTitle string No Pre-fills the MR title field. Supports template expressions.
prefilledPullRequestDescription string No Pre-fills the MR description field. Supports template expressions.
prefilledPullRequestLabels string[] No Pre-selects labels by name.
prefilledBranchName string No Pre-fills the branch name. Supports template expressions.
prefilledCommitMessage string No Pre-fills the commit message used when committing changes before opening the MR. Supports template expressions.

After a successful create, the block produces outputs that can be referenced by downstream blocks. Their names are the same as on <GitPullRequest>, so there is no MR_ID or MR_URL:

Output Description Example
PR_ID The merge request iid, its number within the project 42
PR_URL The full URL of the created merge request https://gitlab.com/acme-corp/infrastructure/-/merge_requests/42

Pass an output to a later block’s script with its env prop:

<Command
id="notify"
title="Post MR Link"
env={{ MR_URL: "{{ .outputs.create_mr.PR_URL }}" }}
command='echo "MR created: $MR_URL"'
/>