Spaces:
Running
Running
Download .github/workflows/keep_alive.yml from IDKHowToCodeFr/hf-backend: direct link, hf CLI and curl.
- Browser
- Download file 823 Bytes
-
https://huggingface.co/spaces/IDKHowToCodeFr/hf-backend/resolve/main/.github/workflows/keep_alive.yml
- Command line
-
hf download hf://spaces/IDKHowToCodeFr/hf-backend/.github/workflows/keep_alive.yml
-
curl -L -o keep_alive.yml https://huggingface.co/spaces/IDKHowToCodeFr/hf-backend/resolve/main/.github/workflows/keep_alive.yml
823 Bytes
| name: Space Keep Alive | |
| on: | |
| schedule: | |
| - cron: "0 */6 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| ping: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ping Health Endpoint | |
| run: | | |
| HOUR=$(python3 -c "import time; print(int(time.time() // 3600))") | |
| if [ "${{ github.event_name }}" != "workflow_dispatch" ] && [ $((HOUR % 30)) -ge 6 ]; then | |
| echo "Skipping ping: not at 30-hour mark (Hour: $HOUR, Remainder: $((HOUR % 30)))." | |
| exit 0 | |
| fi | |
| TARGET_URL="${{ secrets.HF_SPACE_URL }}" | |
| if [ -z "$TARGET_URL" ]; then | |
| TARGET_URL="https://idkhowtocodefr-hf-backend.hf.space/health" | |
| fi | |
| echo "Sending one keep-alive ping to ${TARGET_URL}..." | |
| curl --fail --show-error --silent --max-time 30 "$TARGET_URL" || exit 1 | |