2

I have a few different CI/CD flows, one of them automatically creates GitLab merge requests for specific branches. Each merge request has a generated description and title, with links to resolved issues, etc. After merge request is merged, GitLab creates a merge commit with default schema, and it looks like this:

Merge branch '<my branch>' into '<my other branch>'

<Title of merge request>

See merge request <number of merge request>

I'd like this merge commit to be diffferent, and contain merge request description only, since CD should use it to generate changelogs for each build. I've tried to find an option to change it in GitLab API, but I can't find any parameter or request that would allow me to set merge commit message when it's created, or change it afterwards.

Is there any way to copy merge request description to merge commit body automatically? Maybe some API fields, or templates that can be used?

ikurek
  • 604
  • 11
  • 27

1 Answers1

1

Based on this issue that’s been open for three years, that functionality isn’t even in the UI so an API operation for it most likely wouldn’t exist until that does. https://gitlab.com/gitlab-org/gitlab/-/issues/2551

Your best option until then is to use git:

  1. Clone the repo
  2. Rebase and reword the commit message
  3. Push it back to the remote
Adam Marshall
  • 6,369
  • 1
  • 29
  • 45
  • Although this is an horrendous answer, it is much better than "You can't". If this is the best way to do it, props to you for providing the way forward, painful as it may be! – lmat - Reinstate Monica Aug 23 '21 at 14:32