#!/bin/bash
# Test GitHub Actions workflow locally using act

echo "🧪 Testing GitHub Actions workflow locally..."
echo ""

# Check if act is installed
if ! command -v act &> /dev/null; then
    echo "❌ act is not installed. Install with: brew install act"
    exit 1
fi

# Change to slipmatz-web directory
cd "$(dirname "$0")" || exit 1

echo "📋 Available workflows:"
act --list
echo ""

echo "🔍 Dry-run (no execution):"
echo "   act pull_request --container-architecture linux/amd64 --dryrun"
echo ""

echo "🏗️  Build only (doesn't push to registry):"
echo "   act pull_request --container-architecture linux/amd64 -j build-and-push"
echo ""

echo "🚀 Test push event (simulates main branch push):"
echo "   act push --container-architecture linux/amd64 -j build-and-push"
echo ""

# Ask user what to do
read -p "Run dry-run test? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
    act pull_request --container-architecture linux/amd64 --dryrun
fi
