Skip to content
Latchkey

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' trigger

Common 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

  1. Add an on: block with push, pull_request, or another event.
  2. 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

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