]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Handle empty MR description in dangerfile
authorTom Krizek <tkrizek@isc.org>
Fri, 8 Dec 2023 15:31:46 +0000 (16:31 +0100)
committerMichal Nowak <mnowak@isc.org>
Mon, 11 Dec 2023 16:52:20 +0000 (17:52 +0100)
A merge request might have no description at all (i.e. None, rather than
an empty string). This might happen when the MR is created via an API.
Check a description is present before trying to find a backport string
in it.

(cherry picked from commit 4f70f5bd7cbd79e54d8c37a53267eae62a633c36)

dangerfile.py

index 26cdf92695a109987e87346fac45f96f00d4cc25..119f6e23a3ce75838f71d4ba0c8f3b1752f1b7a8 100644 (file)
@@ -180,7 +180,6 @@ BACKPORT_OF_RE = re.compile(
     r"Backport\s+of.*(merge_requests/|!)([0-9]+)", flags=re.IGNORECASE
 )
 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:
@@ -199,6 +198,7 @@ if is_backport:
                 "Backport MRs must have their target version in the title. "
                 f"Please put `[9.{minor_ver}{edition}]` at the start of the MR title."
             )
+    backport_desc = BACKPORT_OF_RE.search(danger.gitlab.mr.description or "")
     if backport_desc is None:
         fail(
             "Backport MRs must link to the original MR. Please put "