Created
May 30, 2023 10:16
-
-
Save tandv592082/0dd76f9a0aebf890627e06ca54abca17 to your computer and use it in GitHub Desktop.
pre commit hook
This file contains hidden or 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/sh | |
| REPOS="$1" | |
| TXN="$2" | |
| MAVEN_HOME="/opt/apache-maven-3.6.3" | |
| # Change to your project's directory | |
| PROJECT_DIR="/home/tandv/Desktop/convention/demo" | |
| # Change to the project directory | |
| cd "$PROJECT_DIR" || exit 1 | |
| # Run Maven build and tests | |
| "$MAVEN_HOME/bin/mvn" clean verify | |
| # Check the build result | |
| if [ $? -ne 0 ]; then | |
| echo "Maven build or tests failed. Commit rejected." | |
| exit 1 | |
| fi | |
| # All checks passed, allow the commit | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment