From dd8d146493ea82e97a41046d2b03692f3c26b2a5 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Thu, 21 Jul 2022 14:14:42 +0200 Subject: add more debug printing to merge labeler, fix logic errors --- labbot/addons/merge-label.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/labbot/addons/merge-label.py b/labbot/addons/merge-label.py index 27e179b..a978388 100644 --- a/labbot/addons/merge-label.py +++ b/labbot/addons/merge-label.py @@ -36,7 +36,7 @@ async def merge_label_hook(event, gl, *args, **kwargs): state = event.object_attributes["state"] related_issues = [] - if title.lower().startswith("draft"): + if not description or title.lower().startswith("draft"): return match = re.search(title_regex, title) @@ -75,7 +75,7 @@ async def merge_label_hook(event, gl, *args, **kwargs): has_label = False issue_data = await gl.getitem(base_url) for label in issue_data["labels"]: - if label in act_labels or state_label.values(): + if label in act_labels or label in state_label.values(): has_label = True break @@ -91,7 +91,9 @@ async def merge_label_hook(event, gl, *args, **kwargs): delete_labels.remove(label) remove_labels = ",".join(delete_labels) - + log.debug(f"Applying {label} to {issue}") + if remove_labels: + log.debug(f"Removing `{remove_labels} from {issue}") await gl.put(base_url, data={ "add_labels": label, "remove_labels": remove_labels, -- cgit v1.2.3