Files
metabuilder/scripts/pre-commit.hook
johndoe6345789 b3e17e7dd4 feat: Add troubleshooting guide and enhance act scripts
- Created a new troubleshooting guide in README.md for common issues and testing problems.
- Updated package.json to include new act commands for linting, type checking, building, and diagnosing workflows.
- Added a pre-commit hook script to validate workflows before commits.
- Enhanced run-act.sh script with logging, Docker checks, and improved output formatting.
- Improved test-workflows.sh with an interactive menu and performance tracking.
- Introduced setup-act.sh for quick setup and testing of act integration.
2025-12-25 13:16:45 +00:00

48 lines
1.5 KiB
Bash
Raw 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
# Pre-commit git hook for MetaBuilder
# Validates workflows before commits
# Install: cp scripts/pre-commit.hook .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}Pre-Commit Workflow Validation${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Check if any workflow files were modified
if ! git diff --cached --name-only | grep -q '^\.github/workflows/'; then
echo " No workflow files changed, skipping validation"
exit 0
fi
# Run diagnostics if workflow files changed
echo -e "${YELLOW}Validating workflow files...${NC}"
if command -v ./scripts/diagnose-workflows.sh &> /dev/null; then
chmod +x scripts/diagnose-workflows.sh
./scripts/diagnose-workflows.sh
if [ $? -ne 0 ]; then
echo ""
echo -e "${YELLOW}⚠️ Workflow issues detected. Review above before committing.${NC}"
echo "To skip this check: git commit --no-verify"
exit 1
fi
else
echo "Diagnostic script not found, skipping workflow validation"
fi
echo ""
echo -e "${GREEN}✓ Pre-commit checks passed!${NC}"
echo ""
exit 0