Spaces:
Running
Running
| name: HF Space keep-warm | |
| # Periodic ping of the deployed HF Space so judges hitting it during | |
| # the hackathon window land on a warm container, not a 30-60s cold-start. | |
| # GitHub Actions free-tier cron has best-effort scheduling (may drift | |
| # 5-15 min); for judging mornings, supplement with a manual run via | |
| # workflow_dispatch. | |
| on: | |
| schedule: | |
| - cron: "*/12 * * * *" | |
| workflow_dispatch: | |
| jobs: | |
| ping: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 3 | |
| steps: | |
| - name: Ping HF Space surface | |
| run: | | |
| set -u | |
| BASE=https://ujjwalpardeshi-chakravyuh.hf.space | |
| UA="Chakravyuh-KeepWarm/1.0 (+https://github.com/UjjwalPardeshi/Chakravyuh)" | |
| fail=0 | |
| for path in / /health /demo/ /eval; do | |
| code=$(curl -sw '%{http_code}' -o /dev/null --max-time 30 \ | |
| -H "User-Agent: $UA" "$BASE$path") | |
| echo "$path -> $code" | |
| case "$code" in | |
| 2*|301|302|307|308|405) ;; | |
| *) echo "::warning::Space returned $code on $path"; fail=$((fail+1)) ;; | |
| esac | |
| done | |
| # Treat as soft signal — keep-warm is best-effort, never fail the action. | |
| echo "fail count: $fail" | |