Skip to content

Instantly share code, notes, and snippets.

@JamesMcMahon
Created July 22, 2022 21:08
Show Gist options
  • Save JamesMcMahon/25f25bed48a8de9d20c58262123fffcf to your computer and use it in GitHub Desktop.
Save JamesMcMahon/25f25bed48a8de9d20c58262123fffcf to your computer and use it in GitHub Desktop.
Pre-push script for local CI
#!/usr/bin/env sh
set -e
echo "Running pre-push hook..."
git fetch
if ! git diff-index --quiet HEAD --; then
echo "Local changes found, please commit or stash"
exit 1
fi
if ! test -z "$(git ls-files --exclude-standard --others)"; then
echo "Untracked files, please commit or remove"
exit 1
fi
if ! git diff --quiet $(git branch --show-current)..origin/$(git branch --show-current) -- frontend/; then
echo "Verifying Frontend"
cd frontend
npm run verifyAndBuild
cd ..
else
echo "No Changes detected in Frontend, skipping verify"
fi
if ! git diff --quiet $(git branch --show-current)..origin/$(git branch --show-current) -- everyone-parser/; then
echo "Verifying Parser"
cd everyone-parser
npm run verifyAndBuild
cd ..
else
echo "No Changes detected in Parser, skipping verify"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment