From f5a36e4eba3b1f5124b5653f65f06329c33e0819 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Tue, 10 Dec 2024 19:01:35 +0100 Subject: [PATCH] fixup! Look for WIP in commit messages --- .../.ci/scripts/validate_commit_message.py.j2 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/templates/github/.ci/scripts/validate_commit_message.py.j2 b/templates/github/.ci/scripts/validate_commit_message.py.j2 index ae0d7ad5..91935e9d 100644 --- a/templates/github/.ci/scripts/validate_commit_message.py.j2 +++ b/templates/github/.ci/scripts/validate_commit_message.py.j2 @@ -13,14 +13,18 @@ with open("pyproject.toml", "rb") as fp: PYPROJECT_TOML = tomllib.load(fp) KEYWORDS = ["fixes", "closes"] BLOCKING_REGEX = [ - "DRAFT", - "WIP", - "NOMERGE", - r"DO\s*NOT\s*MERGE", - "EXPERIMENT", + r"^DRAFT", + r"^WIP", + r"^NOMERGE", + r"^DO\s*NOT\s*MERGE", + r"^EXPERIMENT", + r"^FIXUP", + r"Apply suggestions from code review", ] try: - CHANGELOG_EXTS = [f".{item['directory']}" for item in PYPROJECT_TOML["tool"]["towncrier"]["type"]] + CHANGELOG_EXTS = [ + f".{item['directory']}" for item in PYPROJECT_TOML["tool"]["towncrier"]["type"] + ] except KeyError: CHANGELOG_EXTS = [".feature", ".bugfix", ".doc", ".removal", ".misc"] NOISSUE_MARKER = "[noissue]" @@ -31,7 +35,7 @@ message = subprocess.check_output(["git", "log", "--format=%B", "-n 1", sha]).de if NOISSUE_MARKER in message: sys.exit(f"Do not add '{NOISSUE_MARKER}' in the commit message.") -if any((re.match(pattern, message) for pattern in BLOCKING_REGEX)): +if any((re.match(pattern, message, re.IGNORECASE) for pattern in BLOCKING_REGEX)): sys.exit("This PR is not ready for consumption.") g = Github(os.environ.get("GITHUB_TOKEN"))