Skip to content

Instantly share code, notes, and snippets.

@devarops
Created May 6, 2026 04:35
Show Gist options
  • Select an option

  • Save devarops/7ffb3d67af67dfa458ff54aa1fc69ab1 to your computer and use it in GitHub Desktop.

Select an option

Save devarops/7ffb3d67af67dfa458ff54aa1fc69ab1 to your computer and use it in GitHub Desktop.
.git/hooks/pre-push
#!/usr/bin/env bash
# pre-push hook to run checks before pushing
CONTAINER_NAME="${PWD##*/}_ci"
echo "=========================================="
echo "🚀 Running pre-push checks in Docker..."
echo "=========================================="
# Run the project's check suite inside the container
docker exec "$CONTAINER_NAME" make check
# Capture the exit status
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo ""
echo "❌ Pre-push checks failed. Push aborted."
echo "Review the errors above and fix them before pushing."
echo "=========================================="
exit 1
fi
echo ""
echo "✅ All checks passed. Proceeding with push..."
echo "=========================================="
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment