Created
March 12, 2020 03:24
-
-
Save damiancipolat/5ab59a618d6a919a4d01cb7e6030b712 to your computer and use it in GitHub Desktop.
Bash script to avoid same package.json version to be used in a githook.
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 -o nounset | |
set -o errexit | |
REPO_ROOT=$(git rev-parse --show-toplevel) | |
echo "Git repo is at $REPO_ROOT" | |
SITE_CHANGES=$(git diff origin/develop -- ./package.json | grep version | wc -l) | |
echo "Detected $SITE_CHANGES changes" | |
if [ "$SITE_CHANGES" != 2 ]; then | |
echo "Version was not updated :( Aborting push." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment