diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-09-07 09:52:37 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-09-07 09:52:37 +0200 |
commit | 256aeeee6077da0a28bcc2fb19ab7923e472d26a (patch) | |
tree | dec941fb85041945e186d007b5150459b7f13223 /labbot/addons/approve-merge.py | |
parent | ec850ccb99d3ebfb8a69483de868097ed8288f7f (diff) | |
download | lab-bot-256aeeee6077da0a28bcc2fb19ab7923e472d26a.tar.gz lab-bot-256aeeee6077da0a28bcc2fb19ab7923e472d26a.zip |
add per repository settings
Diffstat (limited to 'labbot/addons/approve-merge.py')
-rw-r--r-- | labbot/addons/approve-merge.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/labbot/addons/approve-merge.py b/labbot/addons/approve-merge.py index 9b10ef6..9c6eceb 100644 --- a/labbot/addons/approve-merge.py +++ b/labbot/addons/approve-merge.py @@ -4,10 +4,16 @@ is reached. """ import logging +from labbot.config import Config + log = logging.getLogger(__name__) -required_approval_count = 2 +config = Config(__name__) +config.set_global_data( + required_approval_count = 2 +) +@config.config_decorator() async def merge_label_hook(event, gl, *args, **kwargs): title = event.object_attributes["title"] state = event.object_attributes["state"] @@ -24,12 +30,12 @@ async def merge_label_hook(event, gl, *args, **kwargs): approval_count = len(data["approved_by"]) - if approval_count >= required_approval_count: + if approval_count >= config["required_approval_count"]: if merge_status == "can_be_merged": await gl.put(merge_url) else: log.debug(f"Cannot merge !{iid} because of its merge_status `{merge_status}`") def setup(bot): + config.setup(__name__, bot.name) bot.register_merge_hook(merge_label_hook) - pass
\ No newline at end of file |