All checks were successful
Deploy Feature Branch to Test / PHP Syntax Check (push) Successful in 34s
Lint / PHP Syntax Check (push) Successful in 57s
Deploy Feature Branch to Test / CSS Lint (stylelint) (push) Successful in 1m41s
Deploy Feature Branch to Test / HTML Lint (htmlhint) (push) Successful in 1m39s
Lint / CSS Lint (stylelint) (push) Successful in 1m39s
Lint / HTML Lint (htmlhint) (push) Successful in 1m8s
Deploy Feature Branch to Test / Deploy to Test Environment (push) Successful in 30s
Erweitert den Husky pre-commit-Hook um einen PHPUnit-Schritt.
Ausserdem wird scripts/safe-commit.sh aktualisiert, damit das
Safety-Net dieselbe Logik wie der Hook verwendet (kein doppelter Code).
Vorher: Hook rief nur 'npx lint-staged' auf.
Nachher: Hook ruft scripts/pre-commit-checks.sh auf, das
- lint-staged ausfuehrt (unveraendert)
- PHPUnit nur dann ausfuehrt, wenn PHP-relevante Dateien
gestaged sind (Performance-Optimierung: Issue #67 Anforderung)
- Bei Test-Fehler den Commit mit Exit-Code 1 abbricht
Closes #67
30 lines
828 B
Bash
Executable File
30 lines
828 B
Bash
Executable File
#!/usr/bin/env bash
|
||
# safe-commit.sh – Commit with pre-commit hooks guaranteed to run
|
||
# Usage: ./scripts/safe-commit.sh "commit message"
|
||
#
|
||
# This script ensures lint + PHPUnit checks always execute, even when committing
|
||
# from non-interactive contexts (CI, AI agents, etc.).
|
||
|
||
set -euo pipefail
|
||
|
||
if [ -z "${1:-}" ]; then
|
||
echo "❌ Usage: ./scripts/safe-commit.sh \"commit message\""
|
||
exit 1
|
||
fi
|
||
|
||
MSG="$1"
|
||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||
cd "$REPO_ROOT"
|
||
|
||
# Ensure hooks directory exists and is configured
|
||
if [ -d ".husky" ]; then
|
||
git config core.hooksPath .husky
|
||
fi
|
||
|
||
# Run pre-commit checks manually as a safety net (in case hook is skipped)
|
||
# Same logic as .husky/pre-commit, just in case the hook is bypassed.
|
||
./scripts/pre-commit-checks.sh
|
||
|
||
# Commit with hooks enabled (no --no-verify)
|
||
git commit -m "$MSG"
|