Skip to content

Support default templates for issues/MRs via .gitlab/ folders

What does this MR do and why?

This MR reintroduces !76326 (merged) that was reverted due to an issue (#350358 (closed)) with it applying when editing an issuable in addition to new ones. Now, the default template will only be selected if there is the issuable description is empty.

Additionally, the previous MR prioritised .gitlab default templates above project settings, whereas this MR does not.

Screenshots or screen recordings

How to set up and validate locally

  1. Visit the new issue page on a repository, see that no default template was selected

  2. Create a .gitlab/issue_templates/default.md file in that repository

  3. Visit the new issue page on that repository, see that the default.md template was selected

  4. Create a new merge request on a repository, see that no default template was selected

  5. Create a .gitlab/merge_request_templates/default.md file in that repository

  6. Create a new merge request on that repository, see that the default.md template was selected

  7. Now that repository-based default templates have been set, in the project Settings | General, set a "Default description template for issues"

  8. Create a new issue, confirm that content from "Default description template for issues" is preferred over the .gitlab file

  9. in the project Settings | General | Merge requests, set a "Default description template for merge requests"

  10. Create a new merge request, confirm the content from "Default description template for merge requests" is preferred over the .gitlab file

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #2557 (closed)

Edited by David Barr

Merge request reports