Skip to content

Commit 4a67311

Browse files
committed
feat: skip jobs for chore commits
1 parent 6ca3ced commit 4a67311

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
description: >
2+
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
5+
steps:
6+
- checkout
7+
- run:
8+
name: Evaluate commit type
9+
command: |
10+
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
16+
else
17+
echo "Running job for '${COMMIT_MESSAGE%:*}' commit type."
18+
fi

orbs/shared/jobs/docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ executor:
33
name: testbed-machine
44
resource_class: xlarge
55
steps:
6+
- skip_on_chore_commit
67
- setup_environment:
78
machine: true
89
- build_docker_image

orbs/shared/jobs/e2e.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ environment:
3838
USE_DEVSPACE: << parameters.use_devspace >>
3939
resource_class: << parameters.resource_class >>
4040
steps:
41+
- skip_on_chore_commit
4142
- setup_environment:
4243
machine: true
4344
- run:

orbs/shared/jobs/test_node_client.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ parameters:
55
executor:
66
name: testbed-docker
77
steps:
8+
- skip_on_chore_commit
89
- setup_environment
910
- with_node_client_cache:
1011
save: true

0 commit comments

Comments
 (0)