Every workflow must begin with an on: clause that lists the events which cause it to run. Common triggers include push, pull_request, and workflow_dispatch. The workflow_dispatch event in particular allows a workflow to be started manually from the Actions tab in the GitHub UI, from the REST API, or from the GitHub CLI, making it a convenient hook for on-demand jobs.
Scheduled runs are configured with on: schedule:, which accepts POSIX cron syntax evaluated against UTC. For example, on: schedule: - cron: '30 2 * * *' would run the workflow daily at 02:30 UTC. Push and pull_request triggers can be narrowed with branch filters, such as on: push: branches: [main] to limit runs to commits pushed to the main branch, or on: pull_request: branches: [main, develop] to scope pull request runs to those target branches. By default both events run on all branches, but explicit branches or paths filters quickly override that behavior.
Path-based filtering offers finer control. The paths: filter under on: push restricts the trigger to commits that change files matching the given glob patterns, while paths-ignore: excludes commits that modify the listed patterns. Together, these allow you to keep expensive workflows from running when only unrelated files such as documentation or images have been touched.