Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label on issue when MR is merged #138

Open
bagage opened this issue Oct 9, 2018 · 4 comments
Open

Add label on issue when MR is merged #138

bagage opened this issue Oct 9, 2018 · 4 comments

Comments

@bagage
Copy link

bagage commented Oct 9, 2018

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?

@bagage bagage changed the title Add label on merge Add label on issue when MR is merged Oct 9, 2018
@JaimeLennox
Copy link
Contributor

JaimeLennox commented Oct 11, 2018

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).

@snim2
Copy link
Contributor

snim2 commented Sep 17, 2019

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.

@priv-kweihmann
Copy link

Any progress on this here or #147 ? I'm really interested in something like that...

@snim2
Copy link
Contributor

snim2 commented Mar 15, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants