Skip to content

Commit

Permalink
fix(ci): adjust PR titles check (datreeio#695)
Browse files Browse the repository at this point in the history
Co-authored-by: Yishay Mendelsohn <myishay@gmail.com>
  • Loading branch information
naorpeled and myishay authored Jun 27, 2022
1 parent f1f0e61 commit 662747b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/check_pr_title.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json
import os
import sys
import re

COMMIT_TYPES = set(["build", "ci", "docs", "feat", "fix", "perf", "refactor", "test", "style"])
COMMIT_TYPES = set(["build", "ci", "docs", "feat", "fix", "perf", "refactor", "test", "style", "chore"])
MAX_COMMIT_MSG_LEN = 72

def commit_msg_len(msg):
Expand All @@ -20,6 +21,13 @@ def message_format(msg):

def commit_type(msg):
t = msg.split(":")[0].strip()

breaking_change_regex = r"!$"
t = re.sub(breaking_change_regex, "", t)

commit_scope_regex = r"\([^()]*\)"
t = re.sub(commit_scope_regex, "", t)

if t not in COMMIT_TYPES:
print(f"PR type invalid. It needs to be one of {COMMIT_TYPES}. ")
sys.exit(1)
Expand Down

0 comments on commit 662747b

Please sign in to comment.