Skip to content
Latchkey

How to Avoid the Scheduled-Runs-Run-on-Default-Branch-Only Gotcha in GitHub Actions

A schedule trigger reads the workflow file from the default branch only, so edits on a feature branch never take effect until merged.

GitHub evaluates on.schedule using the version of the workflow on the default branch. To validate a schedule change before merge, add a temporary workflow_dispatch and run it from your branch.

Steps

  • Accept that schedule changes take effect only after merging to the default branch.
  • Add workflow_dispatch so you can trigger the same jobs from any branch for testing.
  • After confirming, remove or keep the manual trigger and merge.

Workflow

.github/workflows/ci.yml
on:
  schedule:
    - cron: '0 3 * * *'
  workflow_dispatch:   # lets you test from a feature branch before merge
jobs:
  nightly:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./nightly.sh

Gotchas

  • A brand-new scheduled workflow does nothing until it exists on the default branch.
  • Schedules also disable themselves after 60 days of repository inactivity.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →