Skip to content
Latchkey

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.

Actions annotation
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.

.github/workflows/ci.yml
on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

Check the on: shape

  1. Confirm every filter (branches, paths, tags) sits under an event, not directly under on:.
  2. Use the short form on: push for a single unfiltered event.
  3. 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →