5.8GitHub Actions
GitHub Actions can run a workflow on a schedule. Save the ping URL as a repository secret. Then add steps that report the start, the success and the failure.
- In your repository, open Settings → Secrets and variables → Actions. Add a secret named
OBSRVLY_PING_URLwith your ping URL. - Add the steps below to your scheduled workflow.
- In obsrvly, set the monitor's cron expression to the workflow's
cronvalue. Leave timezone empty, because GitHub schedules use UTC.
name: Nightly export
on:
schedule:
- cron: "15 2 * * *"
workflow_dispatch:
jobs:
export:
runs-on: ubuntu-latest
env:
PING_URL: ${{ secrets.OBSRVLY_PING_URL }}
steps:
- name: Report start
run: curl -fsS -m 10 --retry 3 "$PING_URL/start" > /dev/null || true
- uses: actions/checkout@v4
- name: Run export
run: ./scripts/export.sh
- name: Report success
if: success()
run: curl -fsS -m 10 --retry 3 "$PING_URL" > /dev/null || true
- name: Report failure
if: failure()
run: curl -fsS -m 10 --retry 3 "$PING_URL/fail" > /dev/null || true