Sub topic 16
When a workflow does not run
This chapter assumes you can read a workflow file and know the push, pull_request, schedule and workflow_dispatch events from earlier chapters. It gives a checklist for finding out why a workflow never started.
First, decide what "does not run" means
Open the Actions tab and check which of these cases applies:
- No run appears at all. GitHub never matched the event to your workflow. Most causes are in the list below.
- A run appears but is skipped. An
if:condition on a job was false, or a required job did not finish. - A run appears and fails right away. The workflow file has a syntax error, and the Actions tab shows an error message.
Common causes of a missing run
- The file is in the wrong place. Workflows must be in
.github/workflows/and end in.ymlor.yaml. Subfolders are not searched. - The workflow file is not on the right branch. For
pushandpull_request, GitHub uses the workflow file from the commit that triggered the event. Forscheduleandworkflow_dispatch, it uses the default branch. A new workflow that exists only on a feature branch will never run on a schedule, and it will not show a Run workflow button. - A filter excluded the event. A
branches,tagsorpathsfilter that does not match means no run. Filters are matched with glob patterns, somaindoes not matchrelease/main. Apaths-ignorefilter skips a push that changes only the ignored files. - Mixing
pathsandpaths-ignore. You cannot use both for the same event. Usepathswith!patterns instead. - The pull request has a merge conflict.
pull_requestruns use a temporary merge commit. If the pull request cannot merge cleanly, GitHub does not create that commit, and no run starts. - The activity type is not listed. If you set
types:, only those types start a run. For example, a list withoutsynchronizeignores new commits pushed to the pull request. - The commit message skips CI. Text such as
[skip ci]or[ci skip]in a commit message suppressespushandpull_requestruns. - The event came from
GITHUB_TOKEN. Pushes and pull requests created with the built-in token do not start new runs. Use a personal access token or a GitHub App token if you need that, and make sure it cannot cause a loop. - A scheduled run is late or missing. Schedules use UTC. Runs can be delayed during busy periods, and the shortest interval is five minutes. In a public repository, GitHub disables scheduled workflows after 60 days without repository activity.
- The YAML is invalid. A bad indent or a wrong key can stop the whole file from loading.
Check your cron expression
on:
schedule:
- cron: '30 5 * * 1-5'This runs at 05:30 UTC, Monday to Friday. If you expected local time, convert to UTC first. Quote the expression, because * is special in YAML.
A worked diagnosis
Suppose a workflow should run on pushes to release/1.0, but nothing starts:
on:
push:
branches:
- main
- 'release/*'The pattern release/* matches release/1.0. It does not match a branch named release/1.0/hotfix, because * does not cross a /. Changing the pattern to 'release/**' fixes that case.
Exercise
A workflow with on: schedule was added on a branch named add-nightly. Two days later it has never run. Why, and what is the fix?
Show answer
Scheduled workflows run only from the file on the default branch. Merge the workflow file into the default branch, and the schedule will start working.
Exercise
Your pull_request workflow has types: [opened]. Developers push new commits to open pull requests and see no new runs. What change fixes this?
Show answer
Add synchronize to the list, as in types: [opened, synchronize, reopened]. The synchronize type fires when new commits are pushed to the pull request branch.