Monitor GitHub Actions Scheduled Workflows
GitHub runs scheduled workflows on a best-effort basis. Its docs say a scheduled run “can be delayed during periods of high loads” and that “some queued jobs may be dropped”. In public repositories, GitHub disables scheduled workflows after 60 days without repository activity. GitHub doesn’t tell you when it drops a run or disables a workflow. A Chronos monitor alerts on a failed run and on a run that never happened.
Add the ping step
Section titled “Add the ping step”- Create a monitor with the same cron expression and timezone as the workflow’s
schedule. GitHub uses UTC unless the schedule setstimezone. - In the repository’s Settings, open Secrets and variables, then Actions, and add a repository secret named
CHRONOS_PING_URLwith the monitor’s ping URL. - Add a final step to the job:
name: Nightly report
on: schedule: - cron: '17 6 * * *' workflow_dispatch:
jobs: report: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: ./scripts/report.sh
- name: Ping Chronos if: always() env: PING_URL: ${{ secrets.CHRONOS_PING_URL }} 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 5 -o /dev/null "$PING_URL" || true else curl -fsS -m 10 --retry 5 -o /dev/null --data-raw "$JOB_STATUS: $RUN_URL" "$PING_URL/fail" || true fiif: always() runs the step even when an earlier step failed or the run was cancelled. job.status is success, failure, or cancelled. On anything but success the step sends a fail ping, and the ping’s body puts the run’s link in the down alert. || true keeps a lost ping from failing the run. curl still prints the error in the step’s log, and the monitor goes down after the grace period. The curl flags are the same as for cron.
Pick the schedule and grace period
Section titled “Pick the schedule and grace period”GitHub’s high-load times include the start of every hour, so schedule off the hour, as 17 6 * * * does. Set the monitor’s grace period to cover the workflow’s run time plus the delays you see in the Actions tab. If runs regularly start 20 minutes late, a 30-minute grace period keeps the monitor quiet on a normal day.
Check it works
Section titled “Check it works”workflow_dispatch adds a Run workflow button in the Actions tab. Run the workflow once and the monitor moves from new to up. To test the alert, add exit 1 to a step before the ping and run the workflow again. The monitor goes down, and the alert links to the run. Remove the exit 1 and run it once more to bring the monitor back up.