diff --git a/scripts/pr-governance.py b/scripts/pr-governance.py index 8c5165e39..313be118f 100644 --- a/scripts/pr-governance.py +++ b/scripts/pr-governance.py @@ -41,6 +41,28 @@ ROLLOUT_FIELDS = ( "Rollback path", ) +# Conventional-commit types accepted by .commitlintrc.json. Keep the two in +# sync: commitlint gates the *commits* on a PR, but the repo squash-merges, so +# it is the PR *title* that becomes the subject line on main. +COMMIT_TYPES = ( + "build", + "chore", + "ci", + "deps", + "docs", + "feat", + "fix", + "parity", + "perf", + "refactor", + "revert", + "style", + "test", +) + +# type(optional-scope)!: subject +TITLE_RE = re.compile(rf"^(?:{'|'.join(COMMIT_TYPES)})(?:\([^)]+\))?!?: .+") + SECTION_RE = re.compile(r"^##\s+(.+?)\s*$", re.MULTILINE) CHECKBOX_RE = re.compile(r"^- \[(?P[ xX])\] (?P