Files
portfolio/.githooks
denshooter 7f6694622c
Some checks failed
CI/CD Pipeline (Simple) / test-and-build (push) Has been cancelled
CI/CD Pipeline (Simple) / production (push) Has been cancelled
Fix React DOM warnings and improve pre-push hook
- Fix fill and priority boolean attributes in Hero component
- Improve next/image mock in Jest setup to handle boolean props correctly
- Enhance pre-push hook with better Docker detection and error handling
- Make Docker build test non-blocking (warnings instead of errors)
- Add executable permissions for secret check script
- Prevent React DOM warnings in tests
2025-09-12 23:34:11 +02:00
..
2025-09-12 23:31:46 +02:00

Git Hooks

This directory contains Git hooks for the Portfolio project.

Pre-Push Hook

The pre-push hook runs automatically before every git push and performs the following checks:

Checks Performed:

  1. Node.js Version Check - Ensures Node.js 20+ is installed
  2. Dependency Installation - Installs npm dependencies if needed
  3. Linting - Runs ESLint to check code quality
  4. Tests - Runs Jest test suite
  5. Build - Builds the Next.js application
  6. Security Audit - Runs npm audit for vulnerabilities
  7. Secret Detection - Checks for accidentally committed secrets
  8. Docker Configuration - Validates Dockerfile and docker-compose.yml
  9. Production Checks - Additional checks when pushing to production branch

Production Branch Special Checks:

  • Environment file validation
  • Docker build test
  • Deployment readiness check

Usage:

The hook runs automatically on every push. To manually test it:

# Test the hook manually
.githooks/pre-push

# Or push to trigger it
git push origin main

Bypassing the Hook:

If you need to bypass the hook in an emergency:

git push --no-verify origin main

Note: Only bypass in emergencies. The hook prevents broken code from being pushed.

Troubleshooting:

If the hook fails:

  1. Fix the reported issues (linting errors, test failures, etc.)
  2. Run the checks manually to debug:
    npm run lint
    npm run test
    npm run build
    npm audit
    
  3. Check Node.js version: node --version (should be 20+)
  4. Reinstall dependencies: rm -rf node_modules && npm ci

Configuration:

The hook is configured in .git/config:

[core]
    hooksPath = .githooks

To disable hooks temporarily:

git config core.hooksPath ""

To re-enable:

git config core.hooksPath .githooks