Created
May 10, 2018 03:06
-
-
Save caseycoding/89787c49f4bd37cc9477b3c448324245 to your computer and use it in GitHub Desktop.
Circle CI Pre-commit hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# If validation fails, tell circleci to stop and provide error message. Otherwise, continue. | |
if ! [ -x "$(command -v circleci)" ]; then | |
echo 'Error: circle is not installed. Circle config validation will not occur.' >&2 | |
exit 0 | |
else | |
# The following line is needed by the CircleCI Local Build Tool (due to Docker interactivity) | |
exec < /dev/tty | |
# If validation fails, tell Git to stop and provide error message. Otherwise, continue. | |
if ! eMSG=$(circleci config validate -c .circleci/config.yml); then | |
echo "CircleCI Configuration Failed Validation." | |
echo $eMSG | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment