Merge request template variables support for non-default templates
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=391527) </details> <!--IssueSummary end--> <!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary [Merge request template variables](https://docs.gitlab.com/ee/user/project/description_templates.html#supported-variables-in-merge-request-templates) 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} ``` 2. 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 <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> ### Output of checks <!-- If you are reporting a bug on GitLab.com, uncomment below --> This bug happens on GitLab.com #### Results of GitLab environment info <!-- Input any relevant GitLab environment information if needed. --> <details> <summary>Expand for output related to GitLab environment info</summary> <pre> (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`) </pre> </details> #### Results of GitLab application Check <!-- Input any relevant GitLab application check information if needed. --> <details> <summary>Expand for output related to the GitLab application check</summary> <pre> (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) </pre> </details> ### Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem. -->
issue