Last active
November 10, 2017 17:45
-
-
Save wesm87/4410958577f46dd2d5ec054e54dc6c72 to your computer and use it in GitHub Desktop.
Git post-merge hook to auto-install dependencies
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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
on_changed() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" || return 0 | |
} |
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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
source _helpers.sh | |
on_changed 'yarn.lock' 'yarn' | |
on_changed 'package-lock.json' 'npm install' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment