Created
July 24, 2018 20:04
-
-
Save Plytas/c7afe8695a5b87e7c07fd4e6617c16bf to your computer and use it in GitHub Desktop.
runs composer & npm install after doing a git checkout
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
| #!/usr/bin/env bash | |
| # MIT © Sindre Sorhus - sindresorhus.com | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && echo " * changes detected in $1" && echo " * running $2" && eval "$2" | |
| } | |
| check_run composer.lock "composer install" | |
| check_run package.json "npm install" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -O https://gist.githubusercontent.com/Plytas/c7afe8695a5b87e7c07fd4e6617c16bf/raw/b7f648743f0fd16e6d45aa98a073283da0d1e961/post-checkout && chmod +x post-checkout && mv post-checkout .git/hooks/