Renovate: `draftPR` for gitlab?

Created on 10 Jun 2020  ·  8Comments  ·  Source: renovatebot/renovate

What would you like Renovate to be able to do?
there is a draftPR configuration option for github. even though gitlab has a corollary feature (WIP:) there doesn't appear to be an implementation for it.

Describe the solution you'd like
'draftPR': true in a renovate config file will allow renovate installations on gitlab to create the analogous "WIP:" merge requests

Describe alternatives you've considered
um... guess i could always try to code it in my spare time and PR it in 🗡️

Additional context
just a link to the config docs

gitlab priority-3-normal feature

Most helpful comment

:tada: This issue has been resolved in version 23.64.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

All 8 comments

Can you provide some gitlab API docu for your issue?

it would seem gitlab is simply relying on a string being added to the MR which gitlab's ui then parses and interprets to disable the merge button. very low-tech. 😄

  • this shows that the subject is exposed for creation (naturally as renovate currently works with gitlab and we are using it)

  • this suggests a few ways to turn these into "WIP" mrs, all through adding a string to a comment to or the subject line.

I suppose we could prefix WIP: in this scenario. Especially as you probably don't want the commit message itself to permanently have WIP and only the MR title.

exactly @rarkins prefixing it to the MRs title would be the most appropriate method

the only gotcha i see here is that the current config option is literally draftPR which is a mirror of the github feature's name and gitlab of course uses a different nomenclature, e.g. wipMr

i personally don't mind if the config option retains the current name but that would seem to be a consideration for ease-of-use as the name implied that it was explicitly for github installations.

I think we could stick with the same term. We certainly prefer one common option rather than a separate one per platform and I think draftPr is decent.

As of GitLab 13.2, the "WIP" terminology is deprecated in favor of "Draft". Support for WIP will be removed in 14.0.

This doesn't look too hard to implement, so I'm willing to give it a shot. It looks like the necessary changes would be:

  • Add code in initPlatform to figure out which version of GitLab the endpoint is running. GitLab has an API for that and appears to follow semver practices, so it should be trivial to get, parse, and compare the version number. If < 13.2, use "WIP", else use "Draft".
  • Add code in createPr to add the appropriate prefix to the title if draftPR is true.
  • Add code in updatePr to check if the current title is prefixed, and add the prefix to the new title if so.
  • Add tests for all of the above.

Am I missing anything else?

:tada: This issue has been resolved in version 23.64.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

thanks @rarkins

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZauberNerd picture ZauberNerd  ·  4Comments

amilajack picture amilajack  ·  3Comments

jycouet picture jycouet  ·  4Comments

hutson picture hutson  ·  3Comments

jgarec picture jgarec  ·  3Comments