Quick answer
Every GitHub Actions workflow must define when it runs using the top-level 'on' key.
GitHub Actions Missing 'on'
Every GitHub Actions workflow must define when it runs using the top-level 'on' key. Without it, the workflow is invalid.
Common causes
- Removing or renaming the 'on' key by mistake.
- Using a typo (e.g. 'On' or 'trigger') instead of 'on'.
- Leaving the workflow stub empty.
How to fix
- Add 'on:' at the top level with at least one event (e.g. on: push, or on: pull_request).
- Use the CI Config Linter to validate the full workflow structure.
GitHub Actions Missing “on” means your workflow file does not define any trigger events, so GitHub cannot determine when the automation should run. In GitHub Actions, the top-level on key is required for most workflows because it tells the runner whether to start on events like push, pull_request, workflow_dispatch, or a schedule. This validator helps developers, DevOps teams, and CI/CD maintainers quickly identify a common YAML configuration error before it blocks builds, deployments, or test automation.
How This Validator Works
This checker looks for the top-level on field in a GitHub Actions workflow definition and verifies that at least one valid trigger event is present. In a standard workflow YAML file, on is the event map that connects the workflow to GitHub activity. If the key is missing, empty, or malformed, the workflow may fail validation or never run as expected.
- Checks whether the workflow includes a top-level on key
- Verifies that trigger events are defined under that key
- Helps catch YAML structure issues before deployment
- Supports common triggers such as push, pull_request, and workflow_dispatch
Common Validation Errors
Missing on is usually a structural problem in the workflow file rather than a runtime problem. It often happens when a workflow is copied from a template, partially edited, or generated automatically without a complete event definition.
- No top-level on key — the workflow has jobs, steps, or name fields, but no trigger declaration
- Empty trigger block — on: exists but no events are listed
- Incorrect indentation — on is nested under the wrong section
- YAML syntax issues — formatting errors prevent GitHub from reading the trigger block correctly
- Invalid event names — the key exists, but the event values are not recognized by GitHub Actions
Where This Validator Is Commonly Used
This validation is commonly used anywhere GitHub Actions workflows are created, reviewed, or automated. It is especially useful in teams that rely on CI/CD pipelines and want to prevent broken workflow files from reaching production branches.
- Repository CI/CD setup and maintenance
- Pull request reviews for workflow changes
- Template-based workflow generation
- DevOps and platform engineering checks
- Automation linting in build pipelines
- GitHub Actions documentation and troubleshooting
Why Validation Matters
Validation helps ensure that workflow files are both syntactically correct and operationally meaningful. In GitHub Actions, a workflow without a trigger definition may be valid YAML in a general sense, but it is incomplete as an automation rule. Checking for on early reduces failed runs, confusing repository behavior, and time spent debugging pipeline configuration.
For teams managing multiple repositories, consistent workflow validation also improves maintainability. It makes automation easier to review, safer to update, and more predictable across environments.
Technical Details
GitHub Actions workflow files are typically written in YAML and stored under .github/workflows/. The on key is a top-level workflow property that defines event-based triggers. Depending on the workflow, it may be a single event or a list/map of events.
| File format | YAML |
| Required concept | Top-level trigger declaration |
| Common events | push, pull_request, workflow_dispatch, schedule |
| Typical location | .github/workflows/*.yml or *.yaml |
| Related syntax concerns | Indentation, mapping structure, event names, quoting behavior |
In some YAML parsers, the word on can be treated carefully because of YAML parsing rules and schema differences. GitHub Actions handles it as a workflow trigger key, so the file must be structured in the format GitHub expects.
FAQ
What does “missing on” mean in GitHub Actions?
It means the workflow file does not define the top-level on trigger section. Without that section, GitHub does not know when the workflow should run. This is usually a configuration or YAML structure issue, not a problem with the repository itself.
Is the workflow invalid if it has no on key?
For GitHub Actions, yes, it is incomplete as a workflow definition. The file may still be valid YAML, but it does not function as a runnable automation workflow until a trigger event is added under on.
What are common trigger events for GitHub Actions?
Common triggers include push, pull_request, workflow_dispatch, schedule, and repository events such as releases or tags. The best trigger depends on whether the workflow is for testing, deployment, manual execution, or scheduled automation.
Can a workflow run without on?
No workflow can run automatically without a trigger definition. GitHub Actions needs the on key to know which event should start the job. If you want manual execution, workflow_dispatch is a common trigger to include.
Why does YAML indentation matter here?
YAML is indentation-sensitive. If on is placed at the wrong level, GitHub may not interpret it as a top-level trigger. Even a small spacing mistake can cause the workflow to behave incorrectly or fail validation.
Is on required for every GitHub Actions file?
For a standard workflow file, yes, a trigger definition is expected. Some reusable workflow patterns and advanced configurations may differ in structure, but most workflow files still need a clear event or invocation mechanism.
What is the difference between push and pull_request triggers?
push runs when code is pushed to a branch or tag, while pull_request runs when a pull request is opened, updated, or synchronized. Many teams use both so they can test changes before merge and also validate direct branch updates.
How do I fix a missing on error?
Add a top-level on block to the workflow file and define at least one valid event. For example, you can use on: push or a mapping such as on: [push, pull_request]. Then re-check the YAML structure and indentation.
Can this issue be caused by quoting or formatting?
Yes. While GitHub Actions often accepts several YAML styles, formatting mistakes can still break parsing. Incorrect quoting, nested keys, or malformed lists may prevent the trigger block from being recognized as intended.
Related Validators & Checkers
- YAML Validator — checks general YAML syntax and structure
- GitHub Actions Workflow Validator — validates workflow configuration patterns
- CI/CD Config Validator — checks pipeline files for structural issues
- JSON Validator — useful when comparing workflow metadata or generated config output
- XML Validator — relevant for other automation and configuration formats
FAQ
- What events can I use in GitHub Actions 'on'?
- Common events: push, pull_request, workflow_dispatch, schedule, repository_dispatch. See GitHub docs for the full list.
Fix it now
Try in validator (prefill this example)