-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Parent Epic: #112 - Refactor and Improve E2E Test Execution
Depends On: #120 - Configure GitHub Copilot Agent Environment (Issue 1-4)
Overview
Install Git pre-commit hooks in the Copilot agent's environment to enforce pre-commit checks deterministically. This ensures the agent cannot commit code without running linting checks, even if the agent forgets or ignores the instruction in .github/copilot-instructions.md.
Problem
Previous attempts to instruct the Copilot agent to run pre-commit checks via .github/copilot-instructions.md were not reliable. The agent sometimes:
- Forgot to run checks before committing
- Ignored the instructions
- Committed code that failed linting
Solution: Use Git hooks to enforce checks mechanistically, not instructionally.
Objectives
- Create symlink from
.git/hooks/pre-committo./scripts/pre-commit.sh - Install hook in Copilot setup workflow
- Verify hook works correctly (blocks bad commits)
- Document the hook installation process
Implementation Approach
Use Symlink (NOT Wrapper Script):
ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commitWhy Symlink:
- ✅ Simple - no wrapper script needed
- ✅ Always up-to-date - changes to script are immediately reflected
- ✅ Single source of truth -
./scripts/pre-commit.sh - ✅ Easy to verify -
readlink .git/hooks/pre-commit
Workflow Integration
Add to .github/workflows/copilot-setup-steps.yml:
- name: Install Git pre-commit hooks
run: |
# Create symlink to enforce pre-commit checks
ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
# Verify hook is installed
if [ -L .git/hooks/pre-commit ]; then
echo "✅ Pre-commit hook installed successfully"
readlink .git/hooks/pre-commit
else
echo "❌ Failed to install pre-commit hook"
exit 1
fiAcceptance Criteria
- Pre-commit checks pass
- Hook installation added to Copilot setup workflow
- Hook successfully blocks commits that fail checks
- Hook is verified during workflow execution
- Documentation updated
Time Estimate
2-3 hours
Related Documentation
- Full specification: docs/issues/121-1-5-install-git-precommit-hooks-for-copilot.md
- Removed Integration Test Commit: e9955b0
Copilot