| name: keep-backend-awake | |
| # Free keep-alive for the Hugging Face Space backend. A free HF Space pauses after | |
| # ~48h with no traffic; this pings /healthz so it never goes idle (and stays warm, | |
| # so Shopify webhooks / OAuth never hit a cold start). Cost: a ~5s curl job. | |
| # | |
| # NOTE: GitHub disables scheduled workflows after 60 days of repo inactivity — any | |
| # new commit re-enables them. For a zero-maintenance option use cron-job.org or | |
| # UptimeRobot pointed at the same /healthz URL (see README / chat notes). | |
| on: | |
| schedule: | |
| - cron: "*/10 * * * *" # every 10 minutes (UTC) | |
| workflow_dispatch: {} # lets you run it manually from the Actions tab | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: keepalive | |
| cancel-in-progress: false | |
| jobs: | |
| ping: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ping backend /healthz | |
| run: | | |
| URL="https://victor34593993-flexigo-support-bot.hf.space/healthz" | |
| for i in 1 2 3 4 5; do | |
| code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 40 "$URL" || echo "000") | |
| echo "attempt $i -> HTTP $code" | |
| [ "$code" = "200" ] && exit 0 | |
| sleep 15 | |
| done | |
| echo "backend did not return 200 after retries" | |
| exit 1 | |