Skip to content

Commit 5a4b51b

Browse files
Merge pull request #5 from fullstackzach/another-test-branch
another bad commit
2 parents 27c4232 + e11d2f3 commit 5a4b51b

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.github/scripts/commit-checker.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ git checkout -q $1
66
# Set variables
77
BASE_BRANCH=$2
88
msg_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
1112
invalidCommit=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
2526
for 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

.github/workflows/commit-checker.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on: [pull_request]
55

66
jobs:
77
commit-checker:
8-
if: ${{ !contains(github.event.head_commit.message, '[skip jira]') }}
98
runs-on: ubuntu-latest
109

1110
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# gh-actions-playground
22

3-
test 2
3+
test 23

0 commit comments

Comments
 (0)