Monitoring GitHub Actions scheduled workflows
The nightly workflow stopped running and the Actions tab shows no failures. Why scheduled workflow runs go missing, and the ping that catches it.
To monitor a GitHub Actions scheduled workflow, have it send a ping to a monitor that expects one at the same times. When no ping arrives, you get an alert. The check has to run outside GitHub, because a workflow that stops running produces no error.
GitHub can start an on: schedule workflow late, drop it under load or switch it off after 60 days without activity in a public repository. The Actions tab then shows no failures, because there were no runs to fail.
Why scheduled workflows stop without failing
GitHub documents each of these in its reference for the schedule event:
- Late starts. “The
scheduleevent can be delayed during periods of high loads of GitHub Actions workflow runs.” A workflow set for 02:30 can start well after 02:30. GitHub adds that “high load times include the start of every hour”, which is why the sample below runs at minute 30. - Dropped runs. “If the load is sufficiently high enough, some queued jobs may be dropped.” That night’s run then never happens, and the next one is a day away.
- Disabled after 60 days. “In a public repository, scheduled workflows are automatically disabled when no repository activity has occurred in 60 days.” A finished side project or a stable data repository reaches this limit without anyone noticing. Nothing fails, and no more runs start.
- The default branch only. Scheduled workflows run from the latest commit on the default branch. A workflow file that exists only on a feature branch, or that was deleted from the default branch during a cleanup, never runs.
- Notifications go to one person. GitHub sends the notifications for a scheduled workflow to the user who last changed its cron syntax. Nobody else receives them.
Each of these is the general problem of a job that stops running without an error, reached in a GitHub-specific way. Nothing inside GitHub can report a run that GitHub never started.
Ping from the workflow
Create a monitor for the workflow and store the token from its ping URL as a repository secret named ONEMONITOR_TOKEN. Then add two steps to the job. The first sends a start ping. The last sends a success or fail ping, depending on how the job ended:
name: Nightly export
on:
schedule:
- cron: '30 2 * * *'
workflow_dispatch:
jobs:
export:
runs-on: ubuntu-latest
env:
PING: https://ping.1monitor.io/ping/${{ secrets.ONEMONITOR_TOKEN }}
steps:
- name: Send start ping
run: curl -fsS -m 10 --retry 3 --retry-connrefused "$PING/start" > /dev/null || true
- uses: actions/checkout@v7
- name: Export
run: ./bin/export.sh
- name: Send result ping
if: always()
env:
JOB_STATUS: ${{ job.status }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [ "$JOB_STATUS" = success ]; then
curl -fsS -m 10 --retry 3 --retry-connrefused "$PING/success" > /dev/null || true
else
curl -fsS -m 10 --retry 3 --retry-connrefused \
--data-binary "Job $JOB_STATUS: $RUN_URL" "$PING/fail" > /dev/null || true
fi
Each part of the file prevents a specific failure:
- The start ping comes first, before the checkout. The run then covers the whole job, so its duration includes the checkout. If the runner is lost before the last step, the run shows as started but never finished, and the next start ping closes it as incomplete. The failure leaves a trace instead of nothing.
if: always()on the last step. Without it, GitHub skips the step as soon as an earlier step fails, so a failure would never be reported.always()runs the step even when the job is canceled. GitHub warns against it for steps that can hang, and-m 10stops each curl attempt after 10 seconds.job.statusdecides the ping. Its possible values aresuccess,failureandcancelled. Onlysuccesssends a success ping. A canceled run sends a fail ping, because the export did not finish.- The fail ping carries the status and a link to the run. The request body is stored with the ping. The alert then shows “Job failure” and the link to the run’s log on GitHub.
|| trueafter every curl. A ping that fails must never fail the job. Otherwise a short network problem turns into a failed run on GitHub.- The token is a secret. Anyone who has it can ping your monitor, so it does not belong in the workflow file. GitHub hides secret values in the job log.
The curl flags are explained in pinging from the shell. A fail ping opens an alert as soon as the monitor’s failed-run tolerance is reached, which is 1 run by default.
Use the same schedule, in UTC
“By default, scheduled workflows run in UTC.” A monitor’s timezone, however, defaults to your account’s timezone. So paste the cron expression into a time-based monitor unchanged, and set the monitor’s timezone to UTC. If your account is on Europe/Prague and you leave the monitor on it, the monitor expects the 30 2 * * * run at 02:30 Prague time, which is 01:30 UTC in winter. That is an hour before the workflow starts, so the monitor opens an alert every night.
GitHub also accepts an optional timezone key next to cron, with an IANA name such as Europe/Prague. If your workflow sets one, give the monitor the same timezone instead of UTC. On the night the clocks move forward, GitHub says scheduled workflows in the skipped hour “advance to the next valid time”. 1Monitor expects them at the same moment, so a 02:30 run is expected at 03:00 on that night.
The shortest interval GitHub runs a schedule at is every 5 minutes, which is also the shortest interval on the Free plan.
Allow for late starts
Because GitHub can start a scheduled run late, give the monitor more time than the work itself needs. Two settings cover this. The expected completion is how long after 02:30 the run should normally have finished. The grace period is the extra time 1Monitor waits after that before it opens an alert.
For an export that takes about 10 minutes, a 20-minute expected completion and a 30-minute grace period are a reasonable start. The monitor stays healthy until 02:50 UTC, and opens an alert at 03:20 UTC if no ping has arrived. A run that GitHub started late but that finished by then answers its expected run as usual. A run that GitHub dropped, or a workflow that GitHub disabled, does not, so you hear about it at 03:20 that same night.
Manual runs and re-enabling the workflow
workflow_dispatch adds a Run workflow button to the workflow on the Actions tab, so you can test the pings without waiting for 02:30. A manual run at noon matches no expected run, so the monitor shows it as not expected. It does not count for the 02:30 run, and that run still alerts if it never happens. With Alert on unexpected runs switched on, a manual run also opens an unexpected-run alert, so test the pings before you switch it on.
If GitHub disabled the workflow after 60 days without activity, enable it again on the Actions tab, or run gh workflow enable. The next run that pings resolves the alert.
Something missing from this page?
Tell us