Pick the right workflow trigger
GitHub Actions workflows start in response to events declared under the on: key. This reference lists every trigger event with the activity types you can narrow on, the filters it supports (branches, tags, paths) and the gotchas worth knowing. Search by event name or keyword.
How it works
When something happens in or around a repository — a push, a pull request, a scheduled tick, a manual dispatch — GitHub emits an event. A workflow runs if its on: block names that event and any declared filters and activity types match. Activity types (types:) narrow broad events to specific actions, for example only opened and synchronize pull requests. Filters (branches, tags, paths and their -ignore variants) restrict pushes and PRs to certain refs or changed files.
Several events have important behaviour or security characteristics: pull_request_target runs with secrets and a write token even for fork PRs, schedule runs in UTC with best-effort timing, and workflow_call turns a workflow into a reusable building block. The reference surfaces these in the per-event note.
Tips and examples
- Scope a CI run to relevant branches and files:
on:
push:
branches: [main]
paths: ["src/**", "package.json"]
- React to specific PR activity only:
on:
pull_request:
types: [opened, synchronize, reopened]
- Chain a deploy after CI with
workflow_runand theworkflows:filter, and trigger automation from outside GitHub withrepository_dispatchplus a custom event type. - Treat
pull_request_targetas privileged: neveractions/checkoutthe PR head and run its scripts under it.