Merge request template variables support for non-default templates

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Summary

Merge request template variables do not expand

Steps to reproduce

  1. Create a file .gitlab/merge_request_templates/mytemplate.md with the following content
## MR Description Template

Source branch: %{source_branch}
Target branch: %{target_branch}
First commit: %{first_commit}

First multiline commit:
%{first_multiline_commit}

%{co_authored_by}

All commits:
%{all_commits}
  1. Create a merge request using the mytemplate template

Example Project

https://gitlab.com/gitlab-gold/vlad-mihai/reproduce-issue-391527

https://gitlab.com/gitlab-gold/vlad-mihai/reproduce-issue-391527/-/merge_requests/1

What is the current bug behavior?

Variables are not expanded.

What is the expected correct behavior?

Variables are expanded.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited Jun 10, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading