name: Lighthouse Scan Cron Job on: schedule: - cron: '0 */6 * * *' # Every 6 hours workflow_dispatch: # Allow manual triggering jobs: scan: runs-on: ubuntu-latest steps: - name: Trigger Scan run: | # Get the deployment URL from environment or use a default DEPLOYMENT_URL="${DEPLOYMENT_URL:-https://your-domain.com}" echo "Triggering scan at: $DEPLOYMENT_URL/api/cron/scan?mode=all" # Make the API call response=$(curl -s -w "\n%{http_code}" -X POST "$DEPLOYMENT_URL/api/cron/scan?mode=all") # Extract response body and status code http_code=$(echo "$response" | tail -n1) response_body=$(echo "$response" | head -n -1) echo "Response Status: $http_code" echo "Response Body: $response_body" # Check if the request was successful if [ "$http_code" -eq 200 ]; then echo "✅ Scan triggered successfully" else echo "❌ Failed to trigger scan. Status: $http_code" exit 1 fi env: DEPLOYMENT_URL: ${{ secrets.DEPLOYMENT_URL }}