Ping server and restart service #58157
This file contains 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: Ping server and restart service | |
on: | |
# Triggers the workflow every 5 minutes | |
schedule: | |
- cron: "*/5 * * * *" | |
# Triggers the workflow every hour | |
- cron: "0 * * * *" | |
jobs: | |
ping: | |
runs-on: ubuntu-latest | |
if: github.event.schedule == '*/5 * * * *' | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v4 # checkout the repository content | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" # install the python version needed | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: execute py script # run ping.py | |
run: python ping.py | |
restart-service: | |
runs-on: ubuntu-latest | |
if: github.event.schedule == '0 * * * *' | |
steps: | |
- name: Restart Render Service | |
env: | |
RENDER_API_TOKEN: ${{ secrets.RENDER_API_TOKEN }} | |
run: | | |
curl --request POST \ | |
--url https://api.render.com/v1/services/srv-chglpirhp8u065oa4gf0/restart \ | |
--header 'accept: application/json' \ | |
--header "authorization: Bearer $RENDER_API_TOKEN" |