Scheduled workflow not running (only runs on the default branch) in CI
A scheduled workflow only runs when its file is on the repository default branch (usually main). If you added the schedule trigger on a feature branch, the cron never fires until that file is merged to the default branch.
What this error means
You added an on: schedule workflow, waited past the cron time, and no run appears in the Actions tab. The workflow works when you trigger it manually but the schedule is silent.
# .github/workflows/nightly.yml on branch "feature/cron"
on:
schedule:
- cron: '0 3 * * *'
# 3:00 UTC passes, no run is created. The Actions tab shows nothing.Common causes
The workflow file is not on the default branch
GitHub only evaluates schedule triggers from the workflow file on the default branch. A schedule defined on a feature branch is ignored until merged.
The default branch is not what you think
If the default branch is master or develop but the schedule lives on main, the cron will not run from there.
How to fix it
Merge the scheduled workflow to the default branch
- Confirm the default branch under Settings > Branches.
- Merge the workflow file that contains
on: scheduleinto that branch. - Wait for the next cron slot, or use workflow_dispatch to verify the job body works.
git checkout main
git merge feature/cron
git push origin mainAdd workflow_dispatch to test without waiting
Combine schedule with workflow_dispatch so you can run the same workflow manually to confirm it is correct before the next cron slot.
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch: {}How to prevent it
- Add and test scheduled workflows on the default branch.
- Always pair
schedulewithworkflow_dispatchfor manual verification. - Remember that branch edits never change what the schedule runs.