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