Workflow triggers are events that cause a workflow to run. These events can be:
- Events that occur in your workflow's repository
- Events that occur outside of GitHub and trigger a
repository_dispatch
event on GitHub
- Scheduled times
- Manual
For example, you can configure your workflow to run when a push is made to the default branch of your repository, when a release is created, or when an issue is opened.
The following steps occur to trigger a workflow run:
-
An event occurs on your repository. The event has an associated commit SHA and Git ref.
-
GitHub searches the .github/workflows
directory in your repository for workflow files that are present in the associated commit SHA or Git ref of the event.
-
A workflow run is triggered for any workflows that have on:
values that match the triggering event. Some events also require the workflow file to be present on the default branch of the repository in order to run.
Each workflow run will use the version of the workflow that is present in the associated commit SHA or Git ref of the event. When a workflow runs, GitHub sets the GITHUB_SHA
(commit SHA) and GITHUB_REF
(Git ref) environment variables in the runner environment.
-