]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
danger: check the Affects labels are set
authorTom Krizek <tkrizek@isc.org>
Mon, 19 Dec 2022 14:14:48 +0000 (15:14 +0100)
committerTom Krizek <tkrizek@isc.org>
Fri, 23 Dec 2022 08:53:34 +0000 (09:53 +0100)
Unless the MR is a backport, the Affects labels should be used to
indicate which versions are affected by the issue that prompted the MR.

(cherry picked from commit 64d71a1f5f13aec1bf380c06c404f3ae8f49684e)

dangerfile.py

index f9b2e7ede04bc405d503f79f3ca5a0f28f528e7b..4652df2ee596ac24522481c107bd0d39f2774143 100644 (file)
@@ -175,6 +175,7 @@ BACKPORT_OF_RE = re.compile(
 VERSION_LABEL_RE = re.compile(r"v9.([0-9]+)(-S)?")
 backport_desc = BACKPORT_OF_RE.search(danger.gitlab.mr.description)
 version_labels = [l for l in mr_labels if l.startswith("v9.")]
+affects_labels = [l for l in mr_labels if l.startswith("Affects v9.")]
 if is_backport:
     if len(version_labels) != 1:
         fail(
@@ -226,12 +227,18 @@ if is_backport:
                             "commits are meant to be backported."
                         )
                         fail(msg)
-if not is_backport and not version_labels:
-    fail(
-        "If this merge request is a backport, set the *Backport* label and "
-        "a single version label (*v9.x*) indicating the target branch. "
-        "If not, set version labels for all targeted backport branches."
-    )
+else:
+    if not version_labels:
+        fail(
+            "If this merge request is a backport, set the *Backport* label and "
+            "a single version label (*v9.x*) indicating the target branch. "
+            "If not, set version labels for all targeted backport branches."
+        )
+    if not affects_labels:
+        warn(
+            "Set `Affects v9.` label(s) for all versions that are affected by "
+            "the issue which this MR addresses."
+        )
 
 ###############################################################################
 # OTHER LABELS