Skip to content

Instantly share code, notes, and snippets.

@gusribeiro
Created January 22, 2024 12:46
Show Gist options
  • Save gusribeiro/d8818978b360b8796992c5c9e4be2a29 to your computer and use it in GitHub Desktop.
Save gusribeiro/d8818978b360b8796992c5c9e4be2a29 to your computer and use it in GitHub Desktop.
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
if echo "$changed_files" | grep -q "$1"; then
echo "Found diff in $1"
eval "$2"
else
echo "Not found any diff in $1"
fi
}
check_run package.json "yarn || npm install"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment