pre-pushโข1.46 kB
#!/bin/bash
set -e
echo "๐ Running pre-push checks..."
# Final security check before push
echo "๐ Final security scan..."
if command -v gitleaks &> /dev/null; then
echo " โข Running comprehensive secret scan..."
gitleaks detect --source . --verbose || {
echo "โ Security scan failed! Cannot push with potential secrets."
exit 1
}
else
echo " โข gitleaks not found, install with: brew install gitleaks"
fi
# Check for dependency vulnerabilities
echo "๐ก๏ธ Checking dependencies for vulnerabilities..."
npm audit --audit-level moderate || {
echo "โ ๏ธ High/critical vulnerabilities found. Consider running 'npm audit fix'"
echo "๐ You can still push, but please address vulnerabilities soon."
}
# Run node compatibility check if Makefile exists
if [ -f "Makefile" ]; then
echo "๐ฆ Checking Node.js compatibility..."
make node-compat || echo "โ ๏ธ Node compatibility check failed, but continuing"
fi
# Build check
echo "๐จ Final build check..."
npm run build || {
echo "โ Build failed! Cannot push broken build."
exit 1
}
# Run test suite (allow some failures for performance tests)
echo "๐งช Running test suite..."
if npm run test; then
echo "โ
All tests passed!"
else
echo "โ ๏ธ Some tests failed, but continuing (performance tests have known issues)"
echo "๐ Please investigate test failures when possible"
fi
echo "โ
Pre-push checks completed!"