GitHub Actions "on" section missing or has no triggers
A workflow needs an on: section with at least one event. Without it the file is invalid or the workflow never fires.
What this error means
The workflow is rejected for a missing on key, or it simply never runs because no event is configured.
github-actions
The workflow is not valid. .github/workflows/ci.yml: The workflow must contain at least one job and an 'on' triggerCommon causes
on key omitted
Forgetting on: entirely leaves the workflow with no trigger.
on coerced to a boolean
Unquoted on can be read by YAML as the boolean true; quote it or use the mapping form.
How to fix it
Declare at least one trigger
- Add an on: block with push, pull_request, or another event.
- Use the mapping form to avoid YAML coercing on to a boolean.
.github/workflows/ci.yml
on:
push:
branches: [main]
pull_request:How to prevent it
- Start every workflow from a template that includes on:.
- Run actionlint to ensure a trigger exists.
Related guides
GitHub Actions "Invalid cron" on schedule triggerFix the GitHub Actions invalid cron error on an on: schedule trigger caused by a malformed five-field POSIX c…
GitHub Actions "Invalid workflow file: error in your yaml syntax"Fix the GitHub Actions "Invalid workflow file: You have an error in your yaml syntax" message caused by tabs,…
GitHub Actions workflow must contain at least one jobFix the GitHub Actions error where the jobs section is missing or empty, leaving the workflow with nothing to…