name: keepalive # Free Hugging Face Spaces pause after a stretch of no traffic. This cron pings the public Space URL # so the demo stays warm and loads instantly for anyone you share it with. Set the Space URL as a # repo VARIABLE (Settings -> Secrets and variables -> Actions -> Variables): name SPACE_URL, value # e.g. https://-amana.hf.space (the direct app URL, not the /spaces/ page). # If SPACE_URL is unset the job no-ops, so this is safe to merge before the Space exists. on: schedule: - cron: "0 */6 * * *" # every 6 hours workflow_dispatch: {} jobs: ping: runs-on: ubuntu-latest steps: - name: Ping the Space to prevent idle-pause env: SPACE_URL: ${{ vars.SPACE_URL }} run: | if [ -z "$SPACE_URL" ]; then echo "SPACE_URL variable not set — skipping (set it once the Space exists)." exit 0 fi echo "Pinging $SPACE_URL" code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 90 "$SPACE_URL" || echo "000") echo "HTTP $code"