Created
February 8, 2021 15:46
-
-
Save mheob/a349b1973da6ef25e928301bfc24359a to your computer and use it in GitHub Desktop.
100HERZ - Craft CMS - Git Hook - post merge
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
#!/usr/bin/env bash | |
# git hook to run a command after `git pull` if a specified file was changed | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
echo "Checking yarn.lock ..." | |
check_run "yarn.lock" "yarn install" | |
echo | |
echo "Checking composer.lock ..." | |
check_run "composer.lock" "composer install" | |
echo | |
echo "Checking cms/composer.lock ..." | |
check_run "cms/composer.lock" "cd cms && composer install" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment