mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 18:19:42 +00:00
danger: check version in MR title
Enforce the version indicator to be at the start of the MR title.
This commit is contained in:
parent
a3fcfe3d71
commit
d1172e011c
@ -174,6 +174,7 @@ if not danger.gitlab.mr.milestone:
|
|||||||
BACKPORT_OF_RE = re.compile(
|
BACKPORT_OF_RE = re.compile(
|
||||||
r"Backport\s+of.*(merge_requests/|!)([0-9]+)", flags=re.IGNORECASE
|
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)
|
backport_desc = BACKPORT_OF_RE.search(danger.gitlab.mr.description)
|
||||||
version_labels = [l for l in mr_labels if l.startswith("v9.")]
|
version_labels = [l for l in mr_labels if l.startswith("v9.")]
|
||||||
if is_backport:
|
if is_backport:
|
||||||
@ -183,11 +184,14 @@ if is_backport:
|
|||||||
"Please also set exactly one version label (*v9.x*)."
|
"Please also set exactly one version label (*v9.x*)."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
mr_title_version = f"[{version_labels[0].replace('.', '_')}]"
|
minor_ver, edition = VERSION_LABEL_RE.search(version_labels[0]).groups()
|
||||||
if mr_title_version not in danger.gitlab.mr.title:
|
edition = "" if edition is None else edition
|
||||||
|
title_re = f"^\\[9.{minor_ver}{edition}\\]"
|
||||||
|
match = re.search(title_re, danger.gitlab.mr.title)
|
||||||
|
if match is None:
|
||||||
fail(
|
fail(
|
||||||
"Backport MRs must have their target branch in the "
|
"Backport MRs must have their target version in the title. "
|
||||||
f"title. Please put `{mr_title_version}` in the MR title."
|
f"Please put `[9.{minor_ver}{edition}]` at the start of the MR title."
|
||||||
)
|
)
|
||||||
if backport_desc is None:
|
if backport_desc is None:
|
||||||
fail(
|
fail(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user