bitsofchris Claude Opus 4.7 (1M context) commited on
Commit
faef56f
·
1 Parent(s): 07a970c

Add GitHub Actions cron to keep the HF Space warm

Browse files

HF free tier Spaces sleep when no external traffic hits them, so the
internal autorefresh thread stalls during idle periods. A 10-min cron
pings the public Space URL to keep it awake. Workflow lives in the
GitHub mirror at github.com/bitsofchris/time-series-ai-weather-forecast.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

.github/workflows/keep-space-warm.yml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: keep-space-warm
2
+
3
+ # GitHub Actions cron that pings the HF Space every ~10 minutes so its
4
+ # autorefresh thread keeps running (HF free tier sleeps a Space when no
5
+ # external traffic hits it for a while; the daemon thread inside the Space
6
+ # cannot keep it alive on its own).
7
+ #
8
+ # Notes:
9
+ # - GitHub cron has 5-min minimum granularity and can be delayed up to
10
+ # ~15 min during high load. */10 is a good middle ground.
11
+ # - Cron only runs on the default branch — push this file to the default
12
+ # branch of a GitHub repo (e.g. a mirror of this HF Space repo, or a
13
+ # dedicated tiny repo just for this workflow).
14
+ # - workflow_dispatch lets you trigger a one-off run from the Actions tab.
15
+
16
+ on:
17
+ schedule:
18
+ - cron: "*/10 * * * *"
19
+ workflow_dispatch:
20
+
21
+ permissions:
22
+ contents: read
23
+
24
+ jobs:
25
+ ping:
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 2
28
+ steps:
29
+ - name: Wake up the Space
30
+ env:
31
+ URL: https://bitsofchris-time-series-ai-weather-forecast.hf.space/
32
+ run: |
33
+ set -euo pipefail
34
+ curl -fsSL --retry 5 --retry-delay 5 --max-time 60 \
35
+ "$URL" -o /dev/null \
36
+ -w "ping status=%{http_code} time=%{time_total}s url=%{url_effective}\n"