Last active
September 1, 2021 00:42
-
-
Save rogeruiz/ba7a6f85a9d3b7fd53c41054b7b08e61 to your computer and use it in GitHub Desktop.
Checking for file changes and running them on the `post-merge` git hook
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
#!/bin/bash | |
function changed { | |
git diff --name-only HEAD@{1} HEAD | grep "^$1" > /dev/null 2>&1 | |
} | |
if changed 'migrations/'; then | |
echo "🗄 The migrations/ directory has changed. Run migrations script to get up-to-date." | |
fi | |
if changed 'package-lock.json'; then | |
echo "📦 The package-lock.json file has changed. Run npm install to bring your dependencies up to date." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment