Skip to content

Commit

Permalink
Fix CI config to check if branch is master before skipping (influxdat…
Browse files Browse the repository at this point in the history
…a#9140)

Related to: influxdata#9076

In order to support skipping a job depending on file changes, only works on non-master branches. This pull requests updates the config to check the current branch.
  • Loading branch information
sspaink authored Apr 16, 2021
1 parent 1a86fd1 commit 9d163f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ executors:
commands:
check-changed-files-or-halt:
steps:
- run: git diff master --name-only --no-color | egrep -e "^(\.circleci\/.*)|(.*\.(go|mod|sum))|Makefile$" || circleci step halt
- run: ./scripts/check-file-changes.sh
check-changed-files-or-halt-windows:
steps:
- run:
command: git diff master --name-only --no-color | egrep -e "^(\.circleci\/.*)|(.*\.(go|mod|sum))|Makefile$" || circleci step halt
command: ./scripts/check-file-changes.sh
shell: bash.exe
test-go:
parameters:
Expand Down
7 changes: 7 additions & 0 deletions scripts/check-file-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

BRANCH="$(git rev-parse --abbrev-ref HEAD)"
echo $BRANCH
if [[ "$BRANCH" != "master" ]]; then
git diff master --name-only --no-color | egrep -e "^(\.circleci\/.*)|(.*\.(go|mod|sum))|Makefile$" || circleci step halt;
fi

0 comments on commit 9d163f6

Please sign in to comment.