File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ """Check that all PR titles follow the desired scheme.""" # noqa: INP001
2
+
3
+ import os
4
+ import sys
5
+
6
+ KNOWN_PREFIXES = (
7
+ "SEC: " ,
8
+ "BUG: " ,
9
+ "ENH: " ,
10
+ "DEP: " ,
11
+ "PI: " ,
12
+ "ROB: " ,
13
+ "DOC: " ,
14
+ "TST: " ,
15
+ "DEV: " ,
16
+ "STY: " ,
17
+ "MAINT: " ,
18
+ )
19
+ PR_TITLE = os .getenv ("PR_TITLE" , "" )
20
+
21
+ if not PR_TITLE .startswith (KNOWN_PREFIXES ) or not PR_TITLE .split (": " , maxsplit = 1 )[1 ]:
22
+ sys .stderr .write (
23
+ f"The PR title '{ PR_TITLE } ' does not follow the projects naming scheme: "
24
+ "https://pypdf.readthedocs.io/en/latest/dev/intro.html#commit-messages\n " ,
25
+ )
26
+ sys .stderr .write (
27
+ "If you do not know which one to choose or if multiple apply, make a best guess. "
28
+ "Nobody will complain if it does not quite fit :-)\n " ,
29
+ )
30
+ sys .exit (1 )
31
+ else :
32
+ sys .stdout .write (f"PR title '{ PR_TITLE } ' appears to be valid.\n " )
Original file line number Diff line number Diff line change @@ -164,6 +164,12 @@ jobs:
164
164
- name : Test with mypy
165
165
run : |
166
166
mypy pypdf
167
+ - name : Check PR title
168
+ env :
169
+ PR_TITLE : ${{ github.event.pull_request.title }}
170
+ run : |
171
+ python .github/scripts/check_pr_title.py
172
+ if : github.event_name == 'pull_request'
167
173
168
174
package :
169
175
name : Build & verify package
You can’t perform that action at this time.
0 commit comments