Keep Render backend awake #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Keep Render backend awake | |
| on: | |
| schedule: | |
| # Runs every 14 minutes — under Render's 15-minute idle-sleep window. | |
| - cron: '*/14 * * * *' | |
| workflow_dispatch: {} # lets you trigger it manually from the Actions tab to test | |
| jobs: | |
| ping: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ping /health (with retries for cold starts) | |
| run: | | |
| for attempt in 1 2 3; do | |
| echo "Attempt $attempt..." | |
| if curl -sf --max-time 60 "${{ secrets.RENDER_BACKEND_URL }}/health"; then | |
| echo "Backend responded OK" | |
| exit 0 | |
| fi | |
| echo "Attempt $attempt failed, waiting 15s before retry..." | |
| sleep 15 | |
| done | |
| echo "All attempts failed" | |
| exit 1 |