Add label on issue when MR is merged
bagage opened this issue · 4 comments
Would it be possible for marge to automatically add some label to merged requests?
In our workflow, we need to tag merged issues with To test
label. It can be done by adding a comment with content /label ~"\_to test"
. Is it something that would be doable for marge with gitlab API?
Sure, this doesn't seem too difficult to add, and I can imagine there are a lot of workflows based around labels. We might want to make this generic enough that labels can be added at various stages in Marge's lifecycle (e.g. when Marge is currently looking at an MR, as well as after she's finished merging).
I think both this and #147 could be resolved by allowing the user to define some sort of plugin class to implement hooks that are called at various parts of the workflow in single_merge_job.py
. That way, GitLab quick actions can be used to have Marge perform all sorts of custom workflows. This would certainly be something I'd be interested in using.
This is the sort of thing I'm thinking of:
CONGRATS_MESSAGE = """![Congrats](https://media.giphy.com/media/10pHteyVCBH6uI/giphy.gif)
/unlabel ~"Marge Is Merging"
/label ~"Merged By Marge"
/unassign @marge
/done
"""
class MargePlugin:
def __init__(self): pass
def start_mr(self):
return '/label ~"Marge Is Merging'
def merged_mr(self):
return CONGRATS_MESSAGE
and in config.yml
:
add-part-of: true
add-reviewers: true
add-tested: true
...
plugin: ./relative/path/to/plugin.py
Possibly, extending a plugin like this would allow the user to add custom methods for approving MRs (e.g. #145 ), also.
Any progress on this here or #147 ? I'm really interested in something like that...
Just a follow-up to the comment I left above. I would still like to see this implemented, this does need more design thought before we could implement it, but it would open up a lot of possibilities for users with different workflows. One area that needs attention is concurrency: if Marge fires a method in a plugin, that plugin should not block the main thread of the Marge algorithm.