File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : " Check PR title"
2
+
3
+ on :
4
+ pull_request_target :
5
+ types : [opened, edited, synchronize]
6
+
7
+ jobs :
8
+ check-title :
9
+ runs-on : ubuntu-latest
10
+ env :
11
+ PR_TITLE : ${{ github.event.pull_request.title }}
12
+ steps :
13
+ - name : Check if the PR title is well dressed
14
+ if : github.event.pull_request.user.login != 'renovate[bot]' || github.event.pull_request.user.login != 'red-hat-konflux[bot]'
15
+ env :
16
+ JIRA : ' ([A-Z]+-[0-9]+, ?)*[A-Z]+-[0-9]+'
17
+ TEXT : ' : .+'
18
+ run : |
19
+ # Either conventional or JIRA-nnn prefix followed by ': ' and random text:
20
+ REGEX="($JIRA)($TEXT)"
21
+ test_regex() { echo -nE "$1" | grep --perl-regexp --line-regexp "$REGEX" ; }
22
+
23
+ echo "Examples:"
24
+ test_regex 'CMP-123: text'
25
+ test_regex 'CMP-123, OCPBUGS-12345: text'
26
+
27
+ if ! test_regex "$PR_TITLE"
28
+ then
29
+ echo "::error::Please update the PR title so that it follows the convention."
30
+ exit 1
31
+ fi
You can’t perform that action at this time.
0 commit comments