Add %{issue_id} and %{issue_title} placeholders to MR title template

Summary

Extends the MR title template feature (!228477 (merged)) with two new placeholder variables:

  • %{issue_id} — the IID of the issue linked via the source branch name (for example, 123 from branch 123-fix-bug)
  • %{issue_title} — the title of that issue

This lets users configure templates like:

``` Resolve %{issue_id} "%{issue_title}" ```

Which produces: Resolve 123 "Fix the login bug" — a configurable version of the existing default title behavior when a branch name starts with an issue IID.

What does this MR do?

  • Adds issue_id and issue_title to PLACEHOLDERS in MessageGenerator, accepting the issue as a 4th argument (consistent with the existing squash arg pattern)
  • Updates all existing PLACEHOLDERS lambdas to accept the 4th _ arg for a consistent signature
  • Adds issue: nil keyword arg to MessageGenerator#new_mr_title and threads it through to replace_placeholders, following the same pattern as squash: in squash_commit_message
  • BuildService#assign_title_from_template passes the already-memoized issue (resolved from branch name via IssuesFinder, respecting visibility) — no extra DB query
  • Adds issue_id and issue_title to ALLOWED_NEW_MR_TITLE_PLACEHOLDERS
  • Adds specs to MessageGenerator and BuildService
  • Updates documentation

MR acceptance checklist

  • I have evaluated the MR acceptance checklist for this MR.

References

Edited by Marc Shaw

Merge request reports

Loading