From e3e0d28cac8b454aa4d7d0dcd16f88bd4116f8a5 Mon Sep 17 00:00:00 2001 From: CodeSigils Date: Tue, 13 Oct 2026 20:20:12 +0300 Subject: [PATCH] fix: parse escaped commit-message newlines what: Normalize literal newline escapes before validating what and why fields in commit messages. why: GitHub CLI merge bodies can encode newlines literally, which otherwise causes valid rationale fields to be rejected. --- scripts/check_commit_messages.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/check_commit_messages.py b/scripts/check_commit_messages.py index 76b5256..c578d65 100755 --- a/scripts/check_commit_messages.py +++ b/scripts/check_commit_messages.py @@ -36,7 +36,8 @@ def main() -> int: text=True, capture_output=True, ).stdout.strip() - lines = body.splitlines() + normalized_body = body.replace("\\n", "\n") + lines = normalized_body.splitlines() subject = lines[0].strip() if lines else "" if not subject: errors.append(f"{commit[:12]}: empty subject") @@ -45,7 +46,7 @@ def main() -> int: elif subject.endswith("."): errors.append(f"{commit[:12]}: subject must not end with a period") - lower = body.lower() + lower = normalized_body.lower() for field in ("what:", "why:"): if field not in lower: errors.append(f"{commit[:12]}: missing {field} field")