forked from github/copilot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit
More file actions
29 lines (24 loc) · 754 Bytes
/
Copy pathpre-commit
File metadata and controls
29 lines (24 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
#
# Pre-commit hook that runs Spotless check on the Java SDK when Java source
# files are staged. Only triggers if changes exist under java/src/.
#
# To install this hook, run from the repository root:
# git config core.hooksPath .githooks
#
# Only run Spotless if staged changes include Java source files under java/src/
if ! git diff --cached --name-only | grep -q '^java/src/'; then
exit 0
fi
echo "Running Spotless check on java/ ..."
# Run spotless check from the java directory
(cd java && mvn spotless:check -q)
if [ $? -ne 0 ]; then
echo ""
echo "❌ Spotless check failed!"
echo " Run 'cd java && mvn spotless:apply' to fix formatting issues."
echo ""
exit 1
fi
echo "✓ Spotless check passed"
exit 0