From babdac49c8cfa1799ccdba8e6b7f5b04c9edb819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Mon, 14 Oct 2024 19:32:39 +0200 Subject: [PATCH] Make changelog audience mandatory Use a stricter hazard check which ensures the audience tag is present in the MR title and is one of the known values. This prevents siuations where incorrect audience is accidentally used, resulting in a missing changelog entry or a release note. (cherry picked from commit cdb93bcbd45535e304717aca43571a9e2e2d17fc) --- dangerfile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dangerfile.py b/dangerfile.py index 93127eaaf5..79aa9c04aa 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -71,9 +71,11 @@ mr = proj.mergerequests.get(os.environ["CI_MERGE_REQUEST_IID"]) # - FAIL if the MR title doesn't have the expected format # # - FAIL if the MR title doesn't contain changelog action +# +# - FAIL if the MR title doesn't contain changelog audience MR_TITLE_RE = re.compile( - r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?((chg|fix|new|rem|sec):)?\s*((dev|usr|pkg|doc|test)\s*:)?\s*([^\n]*)$", + r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?((chg|fix|new|rem|sec):)?\s*((dev|usr|pkg|doc|test|ci|nil)\s*:)?\s*([^\n]*)$", ) mr_title_match = MR_TITLE_RE.match(mr_title) mr_title_cve = mr_title_match.group(3) if mr_title_match else None @@ -85,7 +87,11 @@ if not mr_title_match: else: if mr_title_action is None: fail( - "Add one of `chg:`|`fix:`|`new:`|`rem:`|`sec:` to the MR title to categorize this change." + "Add one of `chg:`|`fix:`|`new:`|`rem:`|`sec:` to the MR title to [categorize this change](https://gitlab.isc.org/isc-projects/bind9/-/wikis/BIND-development-workflow#mr-title)." + ) + if mr_title_audience is None: + fail( + "Add one of `dev:`|`usr:`|`pkg:`|`doc:`|`test:`|`ci:`|`nil:` to the MR title as [intended audience](https://gitlab.isc.org/isc-projects/bind9/-/wikis/BIND-development-workflow#mr-title)." ) ###############################################################################