File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ git checkout -q $1
66# Set variables
77BASE_BRANCH=$2
88msg_regex=' (AAA|BBB|CCC)\-[0-9]+'
9+ skip_regex=' \[SKIP JIRA\]'
910
1011# Initialize invalidCommit as false, will be set to true by any invalid commits
1112invalidCommit=false
@@ -23,7 +24,16 @@ BRANCH_COMMITS=$(git rev-list ${BRANCH_MERGE_BASE}..HEAD)
2324
2425# Check every commit message since ancestor for regex match
2526for commit in $BRANCH_COMMITS ; do
26- if git log --max-count=1 --format=%B $commit | tr ' [a-z]' ' [A-Z]' | grep -iqE " $msg_regex " ; then
27+ CURRENT_COMMIT_MSG=$( git log --max-count=1 --format=%B $commit | tr ' [a-z]' ' [A-Z]' )
28+
29+ if echo $COMMIT_MSG_UPPER | grep -iqE " $skip_regex " ; then
30+ echo " ************"
31+ echo " [skip jira] detected, skipping commit linting"
32+ echo " ************"
33+ exit 0
34+ fi
35+
36+ if echo $COMMIT_MSG_UPPER | grep -iqE " $msg_regex " ; then
2737 : # If commit matches regex, commit is valid, do nothing
2838 else
2939 # If commit doesn't match regex, commit isn't valid, print commit info
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ on: [pull_request]
55
66jobs :
77 commit-checker :
8- if : ${{ !contains(github.event.head_commit.message, '[skip jira]') }}
98 runs-on : ubuntu-latest
109
1110 steps :
Original file line number Diff line number Diff line change 11# gh-actions-playground
22
3- test 2
3+ test 23
You can’t perform that action at this time.
0 commit comments