Created
May 15, 2019 14:33
-
-
Save ahobson/e6d698dff9a8361d7cc350bf44649b66 to your computer and use it in GitHub Desktop.
pre-commit
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/bash | |
set -euo pipefail | |
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
rootdir="$(cd $scriptdir/../.. > /dev/null 2>&1 && pwd)" | |
circleconfig="${rootdir}/.circleci/config.yml" | |
image=$(ruby -ryaml -e 'puts YAML.load_file(ARGV.last).dig("jobs","build","docker", 0, "image")' $circleconfig) | |
exec docker run \ | |
-i \ | |
--rm=true \ | |
-v ${rootdir}:/app \ | |
-v ${rootdir}/.pre-commit-cache:/home/circleci/.cache \ | |
-w /app \ | |
${image} \ | |
/app/.git/hooks/pre-commit.py | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment