Skip to content

Commit

Permalink
fixup! Look for WIP in commit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellweg committed Dec 10, 2024
1 parent aa837c8 commit f5a36e4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions templates/github/.ci/scripts/validate_commit_message.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand All @@ -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"))
Expand Down

0 comments on commit f5a36e4

Please sign in to comment.