← All articles
Monitor types · 9 min read

Monitor GitHub Actions scheduled workflows reliably

A laptop screen showing code in a dark room with blue light.

GitHub's failure notifications have one limit: they need a run to exist. If a scheduled workflow is dropped from the queue or disabled, no run fails, so nothing tells you. Your nightly export just stops arriving, and you learn about it when someone needs the file. The fix is to invert the signal. The workflow reports success to an outside system, and that system treats silence as the failure.

Why do scheduled GitHub Actions fail silently?

Scheduled workflows fail silently because several failures happen before any job runs. GitHub's documentation says queued jobs may be dropped under high load, and public repository schedules are disabled after 60 days without repository activity. In both cases, no failed run appears.

FailureWhat you see in GitHubDoes a failure email help?Does a heartbeat catch it?
Step exits non-zeroRed runYesYes
Run starts lateGreen run, later than plannedNoYes, if later than the window
Run is droppedNo run for that timeNoYes
Workflow is disabledDisabled state, no new runsNoYes
Job succeeds but does the wrong workGreen runNoNo

The last row is a real limit. A heartbeat proves that your script reached the end with a zero exit code. It cannot prove that the export contains the right data, so your script must validate its own output and exit non-zero when the result is wrong.

How do you add a heartbeat to a scheduled workflow?

Add a final step that requests a unique heartbeat URL and runs only when earlier steps succeed. GitHub's shortest schedule interval is 5 minutes, so a heartbeat monitor's 30-second evaluation is more than frequent enough. The monitor opens an incident when the signal stops arriving within its grace window.

The heartbeat URL your workflow calls as its last step.
The heartbeat URL your workflow calls as its last step.

A heartbeat is an inbound signal: your job calls the monitor, and the monitor alerts on absence. If you have not used this pattern, the cron job heartbeat tutorial explains it from the beginning. The steps below use MonitorAH's URL format, but any heartbeat service works the same way.

Step 1: store the URL as a secret

Anyone who has the URL can send a fake success signal, so do not commit it. Store it as a repository secret with the GitHub CLI, using the token from your heartbeat monitor.

gh secret set HEARTBEAT_URL \
  --body "https://monitorah.com/api/v1/heartbeat/YOUR_TOKEN"

Step 2: add the success-only step

Save this as .github/workflows/nightly-export.yml. The cron expression runs at 03:17 UTC. An off-peak minute is a sensible choice because many workflows start at the top of the hour.

name: Nightly export

on:
  schedule:
    - cron: "17 3 * * *"
  workflow_dispatch:

permissions:
  contents: read

jobs:
  export:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4

      - name: Run export
        run: ./scripts/export.sh

      - name: Send heartbeat
        if: ${{ success() }}
        env:
          HEARTBEAT_URL: ${{ secrets.HEARTBEAT_URL }}
        run: curl -fsS -m 10 --retry 3 --retry-all-errors -o /dev/null "$HEARTBEAT_URL"

GitHub skips later steps after a failure by default, so success() is technically the default condition. Keep it visible anyway, because it documents the intent for the next person who edits the file. Never use always() here. That would report success after a failed export and hide the problem you are trying to detect.

Step 3: prove both paths

The workflow_dispatch trigger lets you start the workflow by hand. Run it, then confirm that the monitor's last heartbeat time changes.

gh workflow run nightly-export.yml
sleep 5
gh run watch "$(gh run list --workflow nightly-export.yml --limit 1 --json databaseId --jq '.[0].databaseId')" --exit-status

Success looks like a green run and a fresh heartbeat. Now test the negative path. Add exit 1 to the start of the export script on a test branch, run the workflow with gh workflow run nightly-export.yml --ref your-branch, and confirm that the heartbeat step shows as skipped and the timestamp does not move.

How do you handle workflows with several jobs?

Use a dedicated heartbeat job that lists every required job under needs. GitHub runs that job only if all listed jobs succeed, so a failed build or publish suppresses the signal. A heartbeat step inside one job proves only that job finished, which is a false success in a multi-job workflow.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./scripts/build.sh

  publish:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./scripts/publish.sh

  heartbeat:
    needs: [build, publish]
    runs-on: ubuntu-latest
    steps:
      - name: Send heartbeat
        env:
          HEARTBEAT_URL: ${{ secrets.HEARTBEAT_URL }}
        run: curl -fsS -m 10 --retry 3 --retry-all-errors -o /dev/null "$HEARTBEAT_URL"

If you use a matrix, list the matrix job under needs. The heartbeat job then waits for all of its variants and is skipped if any variant fails. Avoid continue-on-error on work that matters, because it lets a failed step count as a pass for this logic.

What happens when runs are delayed, dropped or disabled?

Each failure needs a different response. A delayed run still arrives, a dropped run is missing for one cycle, and a workflow disabled after 60 days of repository inactivity stays missing until someone turns it back on. Your heartbeat alert is the same in all three, so check them in this order.

Delayed runs

A cron expression sets the earliest intended start time. It does not reserve a runner. When GitHub is busy, your run can start after the scheduled minute. If the job depends on exact timing, such as a market close, GitHub's scheduler is the wrong tool. Trigger it from a system with stronger timing guarantees, using workflow_dispatch through the API.

Dropped runs

Under high load, queued jobs may be dropped. The evidence is an absence: the run list has no entry for the expected time. Make your job safe to run twice, then start it manually with gh workflow run. For critical jobs, have each run process everything since the last successful run, so a missed cycle catches up on its own.

Disabled workflows

In public repositories, GitHub disables schedules after 60 days without repository activity. This often hits stable projects, because the repo has no commits precisely when nothing needs changing. List workflows that are not active, then enable the one you need.

gh api repos/OWNER/REPO/actions/workflows \
  --jq '.workflows[] | select(.state != "active") | [.name, .state] | @tsv'

gh workflow enable nightly-export.yml

A state of disabled_inactivity confirms the cause. Avoid automatic empty commits as a permanent keepalive. They add noise to history and hide the fact that nobody is maintaining the repository. If a job is important, use a heartbeat alert plus a deliberate re-enable, or move the job to infrastructure you control.

How long should the grace window be?

Set the grace window to the schedule interval plus the longest normal job duration plus a delay margin. MonitorAH measures it from the last ping and allows 30 seconds to 7 days. A daily job that runs for 30 minutes therefore fits a 26-hour window: 24 hours, 30 minutes, and 90 minutes of margin.

ScheduleTypical job timeMarginGrace window
Every 15 minutes2 minutes13 minutes30 minutes
Hourly10 minutes35 minutes1 hour 45 minutes
Every 6 hours20 minutes1 hour 40 minutes8 hours
Daily30 minutes1 hour 30 minutes26 hours
Monday and Thursday1 hour23 hours5 days

A short interval needs a relatively large margin because GitHub's delay does not shrink with your schedule. The 15-minute example tolerates one late run, so a single delay does not page anyone. If you get false alerts, compare recent start times with gh run list and widen the window based on what you observe.

Weekly jobs have a catch. The 7-day maximum leaves no margin for a job that runs every 7 days, so any delay would alert. Run the job twice a week if it is safe to repeat, or use a separate daily check that confirms the latest output is under a week old. A monthly job needs the same daily freshness check.

What mistakes make a heartbeat lie?

A heartbeat lies when it fires without the work having succeeded, or when one workflow's signal covers for another. A schedule can run as often as every 5 minutes, so a shared URL can stay fresh long after a second job stops. Give every scheduled workflow its own URL, then check for these mistakes.

  • Pinging at the start: this proves the job began and says nothing about the result.
  • **Using always():** the signal fires after failure.
  • Sharing one token: one healthy workflow hides another that has stopped.
  • Masking errors: ./export.sh || true turns every failure into a success.
  • **Pipelines without pipefail:** a failure before a pipe can be hidden by the last command. GitHub's default bash shell on Linux sets it only when you declare shell: bash explicitly.
  • **No timeout-minutes:** a hung job holds its runner, and you learn about it later than you should.
  • Heartbeat on manual runs: a manual test can reset the timer while the schedule is broken. Test briefly, then watch the next scheduled run.

Monitoring workflows with MonitorAH

MonitorAH gives each heartbeat monitor a unique URL, https://monitorah.com/api/v1/heartbeat/YOUR_TOKEN, that accepts GET or POST with no API key. It evaluates heartbeats every 30 seconds and supports grace windows from 30 seconds to 7 days. The Free plan includes 10 monitors, with email, Slack, Discord, Telegram and Google Chat alerts.

Read more about cron job monitoring, or create monitors from code with the REST API, available from the Starter plan. If you want a failed job to trigger your own automation, use signed webhook alerts.

Frequently asked questions

Are GitHub Actions cron schedules reliable?

They are suitable for many routine jobs, but they are not exact. The shortest interval is 5 minutes, runs can start late, and GitHub says queued jobs may be dropped under high load. Use them when a late or missed run is recoverable, and monitor any job that matters.

Why did my scheduled GitHub workflow stop running?

In a public repository, the most likely cause is the 60-day inactivity rule, which disables schedules. Run gh workflow list --all to see its state, then gh workflow enable with the file name. Also check that the workflow file is still on the default branch and that its YAML is valid.

Can GitHub notify me when a scheduled workflow does not run?

Not reliably, because its run notifications depend on a run that exists. A dropped or disabled schedule creates no failed run to report. An external heartbeat monitor solves this by expecting a signal from each successful run and alerting you when that signal does not arrive in time.

Should the heartbeat step use always() so I know the job ran?

No. Using always() sends the success signal after failed steps too, so the monitor stays green while the work is broken. Keep the default success condition. If you want to report failures immediately, add a separate failure step that alerts a different endpoint using if: failure().

Does the 60-day disable rule apply to private repositories?

GitHub's documentation describes the 60-day automatic disable for scheduled workflows in public repositories. A heartbeat is still useful for private repositories, because delayed runs, dropped runs, expired credentials and failed steps can affect them too. The monitoring setup is the same for both kinds of repository.

Try MonitorAH free

Three monitors, alerts in under a minute, no credit card. Cover one website and one cron job in the time it takes to read this paragraph.

Start monitoring

Related articles