File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 11description : >
22 If the first commit of the branch (where branch diverged from main/master)
3- starts with 'chore: ' all the following steps of the job will be skipped
4- and the job finishes as succeeded
3+ starts with 'chore', 'ci' or 'docs ' all the following steps of the job will be skipped
4+ and the job finishes as succeeded.
55steps :
66 - checkout
77 - run :
88 name : Evaluate commit type
99 command : |
1010 DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | cut -f 4 -d /)
11- COMMIT_MESSAGE=$(git log $DEFAULT_BRANCH..$CIRCLE_SHA1 --format=%s | tail -1)
12- echo "First commit: $COMMIT_MESSAGE"
13- if [[ "${COMMIT_MESSAGE%:*}" == "chore" ]]; then
14- echo "Skipping job for '${COMMIT_MESSAGE%:*}' commit type."
15- circleci step halt
11+ COMMIT_MESSAGE=$(git log "$DEFAULT_BRANCH..$CIRCLE_SHA1" --format=%s | tail -1)
12+ COMMIT_PREFIX="${COMMIT_MESSAGE%%:*}"
13+ COMMIT_TYPE="${COMMIT_PREFIX%%(*}"
14+ echo "Identified commit type '$COMMIT_TYPE' in the first commit message '$COMMIT_MESSAGE'"
15+ if [[ $COMMIT_TYPE =~ ^(chore|ci|docs)$ ]]; then
16+ echo "Skipping job for '$COMMIT_TYPE' commit type."
17+ circleci-agent step halt
1618 else
17- echo "Running job for '${COMMIT_MESSAGE%:*} ' commit type."
19+ echo "Running job for '$COMMIT_TYPE ' commit type."
1820 fi
You can’t perform that action at this time.
0 commit comments