-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Ensure that the PR titles have the correct format (#2378)
- Loading branch information
1 parent
ed0f29c
commit 2f4f705
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Check that all PR titles follow the desired scheme.""" # noqa: INP001 | ||
|
||
import os | ||
import sys | ||
|
||
KNOWN_PREFIXES = ( | ||
"SEC: ", | ||
"BUG: ", | ||
"ENH: ", | ||
"DEP: ", | ||
"PI: ", | ||
"ROB: ", | ||
"DOC: ", | ||
"TST: ", | ||
"DEV: ", | ||
"STY: ", | ||
"MAINT: ", | ||
) | ||
PR_TITLE = os.getenv("PR_TITLE", "") | ||
|
||
if not PR_TITLE.startswith(KNOWN_PREFIXES) or not PR_TITLE.split(": ", maxsplit=1)[1]: | ||
sys.stderr.write( | ||
f"The PR title '{PR_TITLE}' does not follow the projects naming scheme: " | ||
"https://pypdf.readthedocs.io/en/latest/dev/intro.html#commit-messages\n", | ||
) | ||
sys.stderr.write( | ||
"If you do not know which one to choose or if multiple apply, make a best guess. " | ||
"Nobody will complain if it does not quite fit :-)\n", | ||
) | ||
sys.exit(1) | ||
else: | ||
sys.stdout.write(f"PR title '{PR_TITLE}' appears to be valid.\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters