Last active
August 25, 2020 15:18
-
-
Save vishnu-narayanan/08524df1cdfa9a0753785d60ec532936 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
| set -x | |
| ## Pre-commit hook validation script for the developers. | |
| ## Variables | |
| HOOK_FILE_URL="https://raw.githubusercontent.com/Flux7Labs/central-repo-git-hooks/master/.pre-commit-config.yaml" | |
| ARGS="--all-files" | |
| PKGS="pre-commit cfn-lint flake8 checkov" | |
| BASEDIR="/tmp/hooks" | |
| HOOK_FILE="${BASEDIR}/hookfile" | |
| mkdir -p ${BASEDIR} | |
| curl ${HOOK_FILE_URL} > ${HOOK_FILE} | |
| if [[ -f ${HOOK_FILE} ]]; then | |
| pip3 install $PKGS | |
| pre-commit install | |
| pre-commit clean | |
| pre-commit run -c ${HOOK_FILE} ${ARGS} | |
| pre-commit clean | |
| rm -f ${HOOK_FILE} | |
| else | |
| echo "Unable to download ${HOOK_FILE_URL}. Exiting.." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment