All checks were successful
Deploy Feature Branch to Test / PHP Syntax Check (push) Successful in 34s
Deploy Feature Branch to Test / CSS Lint (stylelint) (push) Successful in 1m12s
Deploy Feature Branch to Test / HTML Lint (htmlhint) (push) Successful in 1m10s
Lint / PHP Syntax Check (push) Successful in 32s
Lint / CSS Lint (stylelint) (push) Successful in 1m14s
Lint / HTML Lint (htmlhint) (push) Successful in 1m9s
Lint / PHP Syntax Check (pull_request) Successful in 32s
Lint / CSS Lint (stylelint) (pull_request) Successful in 1m11s
Lint / HTML Lint (htmlhint) (pull_request) Successful in 1m9s
Deploy Feature Branch to Test / Deploy to Test Environment (push) Successful in 24s
- Add PHP syntax check to lint-staged via scripts/lint-php.sh - Add lint:php script to package.json - Update lint script to include PHP checks - Create scripts/safe-commit.sh for AI agent use - Update deploy-test.yml: lint jobs as gate before deploy - Add branch protection for main requiring status checks - Update AGENTS.md with pre-commit hook rules for agents Also addresses #53: CI requires lint checks before merge Co-authored-by: Claw <claw@openclaw.local>
29 lines
594 B
Bash
Executable File
29 lines
594 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-commit PHP syntax check for lint-staged
|
|
# Called with staged .php files as arguments
|
|
|
|
set -euo pipefail
|
|
|
|
if ! command -v php &>/dev/null; then
|
|
echo "❌ PHP not found. Install php-cli to commit PHP files."
|
|
echo " Ubuntu/Debian: sudo apt-get install php-cli"
|
|
exit 1
|
|
fi
|
|
|
|
errors=0
|
|
for file in "$@"; do
|
|
if ! php -l "$file" >/dev/null 2>&1; then
|
|
echo "❌ Syntax error in $file"
|
|
php -l "$file"
|
|
errors=1
|
|
fi
|
|
done
|
|
|
|
if [ "$errors" -eq 1 ]; then
|
|
echo ""
|
|
echo "❌ PHP lint failed. Fix errors before committing."
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ PHP syntax OK"
|