Monitor a scheduled GitHub Actions workflow
Copy the schedule from the workflow, allow for GitHub's delays in the grace period, then ping from the last steps.
1. Create the monitor from the workflow
Paste the cron value and pick the zone. GitHub reads the schedule in UTC unless the entry sets timezone, so use the same zone on both sides.
2. Allow for delays in the grace period
GitHub documents that scheduled runs can be delayed under high load, and that some queued jobs may be dropped if the load is high enough. Set a grace period longer than the delays you can accept, such as 30 minutes. A dropped run then shows up as a down monitor, which is what the monitor is for.
Scheduled workflows run only on the default branch, and the shortest interval GitHub allows is once every 5 minutes.
3. Ping from the workflow
Store the ping URL as a repository secret named CRONWIZE_PING_URL, because the key is its only credential.
on:
schedule:
- cron: "0 2 * * *"
timezone: "Europe/Belgrade"
jobs:
backup:
runs-on: ubuntu-latest
steps:
- run: curl -fsS -m 10 -o /dev/null "${{ secrets.CRONWIZE_PING_URL }}/start"
- uses: actions/checkout@v4
- run: ./backup.sh
- if: success()
run: curl -fsS -m 10 -o /dev/null "${{ secrets.CRONWIZE_PING_URL }}"
- if: failure()
run: curl -fsS -m 10 -o /dev/null "${{ secrets.CRONWIZE_PING_URL }}/fail"4. Check the first ping
Add workflow_dispatch: under on, then run the workflow by hand from the Actions tab. The monitor turns from new to up.