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.
GitHub Actions
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.
.github/workflows/ci.yml
"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.
.github/workflows/ci.yml
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.
Related guides
GitHub Actions "Required property is missing: jobs" in CIFix GitHub Actions "Required property is missing: jobs" in CI - the workflow has no top-level `jobs` mapping,…
GitHub Actions "Unrecognized named-value: 'env'" in CIFix GitHub Actions "Unrecognized named-value: 'env'" in CI - an expression referenced the `env` context where…
GitHub Actions "mapping values are not allowed in this context" in CIFix GitHub Actions "while scanning ... mapping values are not allowed in this context" in CI - a stray colon…