Skip to content

Commit c31b22a

Browse files
committed
Reapply "On branch edburns/spotless-agentic-workflow-42"
This reverts commit 05d06d9.
1 parent 60dbe62 commit c31b22a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/copilot-instructions.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,18 @@ This SDK is designed to be **lightweight with minimal dependencies**:
244244
5. Check for security vulnerabilities
245245
6. Get team approval for non-trivial additions
246246

247+
## Pre-commit Hooks and Formatting (Coding Agent)
248+
249+
The repository has a pre-commit hook (`.githooks/pre-commit`) that is **automatically enabled** in the Copilot coding agent environment via `copilot-setup-steps.yml`. The hook runs `mvn spotless:check` on any commit that includes changes under `src/`.
250+
251+
**If a commit fails due to the pre-commit hook:**
252+
253+
1. Run `mvn spotless:apply` to auto-fix formatting issues.
254+
2. Re-stage the changed files with `git add -u`.
255+
3. Retry the commit.
256+
257+
**Best practice:** Always run `mvn spotless:apply` before committing Java source changes to avoid hook failures in the first place. If you forget and the hook rejects the commit, follow the three steps above and continue.
258+
247259
## Commit and PR Guidelines
248260

249261
### Commit Messages

.github/workflows/copilot-setup-steps.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
distribution: 'temurin'
4242
cache: 'maven'
4343

44+
# Enable pre-commit hooks so Spotless formatting is enforced on every commit
45+
- name: Enable pre-commit hooks
46+
run: git config core.hooksPath .githooks
47+
4448
# Verify installations
4549
- name: Verify tool installations
4650
run: |
@@ -50,4 +54,6 @@ jobs:
5054
java -version
5155
gh --version
5256
gh aw version
57+
echo "--- Git hooks path ---"
58+
git config core.hooksPath
5359
echo "✅ All tools installed successfully"

0 commit comments

Comments
 (0)