Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active September 5, 2020 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/1c4302299a78d4aad544e1ed91bc1785 to your computer and use it in GitHub Desktop.
Save miguelmota/1c4302299a78d4aad544e1ed91bc1785 to your computer and use it in GitHub Desktop.
Git post-merge hook to auto-build packages on git pull
#!/bin/sh
# Auto-build packages that were modified after a git pull
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -q "$1" && eval "$2"
}
# Example:
check_run "packages/abi/src" "(cd packages/abi && npm run build)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment