Skip to content

Commit

Permalink
Update check_pr_title.py
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <[email protected]>
  • Loading branch information
678098 authored Sep 30, 2024
1 parent 562b392 commit 796c411
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/ext/check_pr_title.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
import os


def check_pr_title():
title = os.environ.get("PR_TITLE")
if title is None or len(title) == 0:
raise RuntimeError("This script expects a non-empty environment variable PR_TITLE set")
raise RuntimeError(
"This script expects a non-empty environment variable PR_TITLE set"
)
title = title.lower()
valid_prefixes = ["fix", "feat", "perf", "ci", "build", "revert", "ut", "it", "docs", "refactor", "misc"]
valid_prefixes = [
"fix",
"feat",
"perf",
"ci",
"build",
"revert",
"ut",
"it",
"docs",
"refactor",
"misc",
"test",
]
if not any(title.startswith(prefix.lower()) for prefix in valid_prefixes):
raise RuntimeError("PR title \"{}\" doesn't start with a valid prefix, allowed prefixes: {}".format(title, " ".join(valid_prefixes)))
raise RuntimeError(
"PR title \"{}\" doesn't start with a valid prefix, allowed prefixes: {}".format(
title, " ".join(valid_prefixes)
)
)


if __name__ == "__main__":
check_pr_title()

0 comments on commit 796c411

Please sign in to comment.