infinite-agents-public/.githooks/pre-commit

30 lines
857 B
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Git pre-commit hook - Auto-update dashboard before commit
#
# Installation:
# cp .githooks/pre-commit .git/hooks/pre-commit
# chmod +x .git/hooks/pre-commit
# Check if any demo files are being committed
demo_changes=$(git diff --cached --name-only | grep -E "(threejs_viz|sdg_viz|src|src_infinite|src_group).*\.html$")
if [ -n "$demo_changes" ]; then
echo "🔍 Demo files detected in commit..."
echo "🔄 Regenerating dashboard..."
# Regenerate dashboard
python3 generate_index.py
# Check if index.html was modified
if git diff --name-only | grep -q "index.html"; then
echo "✅ Dashboard updated - staging index.html"
git add index.html
else
echo " Dashboard already up to date"
fi
else
echo " No demo files in commit - skipping dashboard update"
fi
exit 0