GitHub Actions "No event triggers defined in 'on'" in CI
A workflow must list at least one event under on. When on is empty, null, or its events failed to parse, the validator reports no triggers are defined.
What this error means
The run fails with "Invalid workflow file" and "No event triggers defined in 'on'". The workflow never starts on push or pull_request.
Invalid workflow file: .github/workflows/ci.yml
(Line: 3, Col: 1): No event triggers defined in 'on'Common causes
The on key is empty or null
Writing on: with nothing after it leaves the trigger list empty.
on was quoted away by YAML
Unquoted on: can be read as the boolean true in some YAML loaders, so the events go missing. Quoting "on": avoids this.
How to fix it
List concrete events under on
- Add at least one event such as
pushorpull_request. - Quote the key as
"on":if your tooling coerces it to a boolean. - Re-run by pushing or opening a PR.
"on":
push:
branches: [main]
pull_request:Use the list form for simple triggers
For multiple events without filters, a flow sequence is concise and unambiguous.
on: [push, pull_request]How to prevent it
- Always define at least one event under
on. - Quote
"on"when YAML boolean coercion is a risk. - Validate the workflow before pushing.