GitHub Actions "No event triggers defined in 'on'"
The workflow compiled far enough to read the on: key, but it resolved to nothing - empty, null, or only filters with no event - so GitHub rejects it because no event could ever start it.
What this error means
The workflow is invalid with "No event triggers defined in on". The file may look complete, but on: has no concrete event under it, so the run never appears.
Invalid workflow file: .github/workflows/ci.yml#L1
No event triggers defined in `on`Common causes
on: is empty or null
Writing on: with nothing indented under it, or on: with a trailing colon and a blank value, leaves the trigger map empty so no event is defined.
Only filters, no event
Listing branches: or paths: without a parent event like push: or pull_request: gives filters with no event to attach to, which counts as no trigger.
How to fix it
Define at least one concrete event
Put real events under on:, each with its own filters if needed.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:Check the on: shape
- Confirm every filter (branches, paths, tags) sits under an event, not directly under on:.
- Use the short form on: push for a single unfiltered event.
- Run actionlint to catch an empty or mis-nested on: block before pushing.
How to prevent it
- Always put at least one event under on:.
- Keep branch/path filters nested under their event.
- Lint workflows with actionlint to catch an empty on: block.