Skip to content

Virus Scan Cron

Virus Scan Cron #4591

Workflow file for this run

name: Virus Scan Cron
on:
schedule:
# Run every 5 minutes for faster virus scanning
- cron: '*/5 * * * *'
# Allow manual triggering
workflow_dispatch:
jobs:
virus-scan:
runs-on: ubuntu-latest
steps:
- name: Check Secrets
run: |
if [ -z "${{ secrets.CRON_SECRET }}" ]; then
echo "❌ CRON_SECRET is not set"
exit 1
fi
if [ -z "${{ secrets.VERCEL_URL }}" ]; then
echo "❌ VERCEL_URL is not set"
exit 1
fi
echo "✅ Secrets are configured"
- name: Trigger Virus Scan
id: scan
run: |
echo "🔄 Triggering virus scan at $(date)"
# Ensure URL ends with slash and construct full endpoint URL
base_url="${{ secrets.VERCEL_URL }}"
if [[ "$base_url" != */ ]]; then
base_url="${base_url}/"
fi
endpoint_url="${base_url}api/cron/scan-pending-files"
echo "🔗 Calling endpoint: $endpoint_url"
echo "🔑 Using CRON_SECRET: ${CRON_SECRET:0:10}..." # Show first 10 chars for debugging
response=$(curl -s -L -w "\n%{http_code}" -X GET \
-H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \
-H "User-Agent: GitHub-Actions-VirusScan/1.0" \
-H "Accept: application/json" \
"$endpoint_url")
# Extract response body and status code
http_code=$(echo "$response" | tail -n1)
response_body=$(echo "$response" | head -n -1)
echo "HTTP Status: $http_code"
echo "Response: $response_body"
if [ "$http_code" -eq 200 ]; then
echo "✅ Virus scan completed successfully"
else
echo "❌ Virus scan failed with status $http_code"
exit 1
fi
- name: Log Completion
run: echo "🎉 Virus scan cron completed at $(date)"