Merge request name template convention when linked
Proposal
Use variables when work items are linked with merge request to help generate merge request titles that fit naming conventions.
In Enforce naming convention on MR title (gitlab-org#20108) it is looking at ensuring that the user input for the title of the merge request aligns with a defined naming convention.
When work items and merge requests are linked directly, then we can confidently extract the right information into variables that users can use to auto-generate titles.
For example if teams want merge requests with the title naming convention of issue id followed by a dash and any string afterwards they would define the regex pattern matching rule as ^[0-9]+-.*$|^$. The opportunities for mistakes in linking the work item like this is:
- User doesn't understand the regex
- User fills in wrong work item but matches pattern
When there is a defined link between a work item and a merge request, GitLab can be extract information from the work item to use as a template for a naming convention. Information could be the id and title. So rather than ^[0-9]+-.*$|^$ the user could define a template for a title as %{id} - or %{id} - %{title}
- The variable structure is easier to read
- Information extracted by the system is less prone to errors
- Merge request title can be auto-generated to a defined pattern
Enforce naming convention on MR title (gitlab-org#20108) ensures that the format/pattern is correct where as this proposal ensures that there is a valid work item.
Scenario
- be in compliance with various standards, such as SOX and SOC 2. The goal is to enforce that any merge requests submitted to projects in our GitLab have an associated Jira issue, and to include that Jira issue number as part of the MR title. #25689 (comment 1692855081)
- ensures that if a merge request was created prior to Change Control enablement #416665 (comment 1453069844)
Dependencies / Related issues
This issue relates to