Skip to content

Commit 53fef12

Browse files
committed
feat: skip merge messages that start with Pull request
Bitbucket add as default message when a pull request is merged, the message commit that starts with "Pull request". cz check fails with this kind of messages. Signed-off-by: Angelo Mantellini <manangel@cisco.com>
1 parent 27b4c54 commit 53fef12

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

commitizen/commands/check.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ def _filter_comments(self, msg: str) -> str:
100100

101101
@staticmethod
102102
def validate_commit_message(commit_msg: str, pattern: str) -> bool:
103-
if commit_msg.startswith("Merge") or commit_msg.startswith("Revert"):
103+
if (
104+
commit_msg.startswith("Merge")
105+
or commit_msg.startswith("Revert")
106+
or commit_msg.startswith("Pull request")
107+
):
104108
return True
105109
return bool(re.match(pattern, commit_msg))

tests/commands/test_check_command.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"docs(check): pin pre-commit to v1.16.2",
3939
"docs(check): fix pre-commit setup",
4040
"bump: version 1.16.1 → 1.16.2",
41+
"Pull request #135 from Lee-W/fix-pre-commit-hook\nFix pre commit hook",
4142
"Merge pull request #135 from Lee-W/fix-pre-commit-hook\nFix pre commit hook",
4243
"docs(check): enforce cz check only whem committing",
4344
(
@@ -294,4 +295,4 @@ def test_check_command_with_comment_in_messege_file(mocker, capsys):
294295
)
295296
cli.main()
296297
out, _ = capsys.readouterr()
297-
assert "Commit validation: successful!" in out
298+
assert "Commit validation: successful!" in out

0 commit comments

Comments
 (0)