Skip to content

Commit

Permalink
Merge pull request ansibleplaybookbundle#81 from gbenhaim/run_tests_o…
Browse files Browse the repository at this point in the history
…n_code_change

automation: Run the CI only when the code changed
  • Loading branch information
gbenhaim authored Feb 20, 2018
2 parents 2ef2c8b + ba48049 commit 7096308
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions automation/check-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ install_requirements() {
ansible-galaxy install -r requirements.yml
}

is_code_changed() {
git diff-tree --no-commit-id --name-only -r HEAD..HEAD^ \
| grep -v -E -e '\.md$'

return $?
}

main() {
# cluster_type: Openshift or Kubernetes
# mode:
Expand Down Expand Up @@ -147,5 +154,9 @@ main() {
}

if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
is_code_changed || {
echo 'Code did not changed, skipping tests...'
exit 0
}
main "$@"
fi

0 comments on commit 7096308

Please sign in to comment.