If a name contains any of these characters and you want a literal match, you need to escape each of these special characters with \. The branches and branches-ignore keywords accept glob patterns that use characters like *, **, +, ?, ! and others to match more than one branch name. If you define both branches/ branches-ignore and paths, the workflow will only run when both filters are satisfied. You cannot use both the branches and branches-ignore filters for the same event in a workflow. Use the branches-ignore filter when you only want to exclude branch name patterns. Use the branches filter when you want to include branch name patterns or when you want to both include and exclude branch names patterns. When using the pull_request and pull_request_target events, you can configure a workflow to run only for pull requests that target specific branches. For more information about each event and their activity types, see " Events that trigger workflows." on: label: types: When only one activity type triggers a webhook event, the types keyword is unnecessary. The types keyword enables you to narrow down activity that causes the workflow to run. For example, the label is triggered when a label is created, edited, or deleted. Most GitHub events are triggered by more than one type of activity. Use on.types to define the type of activity that will trigger a workflow run. On: label: types: - created push: branches: - main page_build: on.types A push is made to a GitHub Pages-enabled branch.A push is made to the main branch in the repository.You must append a colon ( :) to all events, including events without configuration.įor example, a workflow with the following on value will run when: If you specify activity types or filters for an event and your workflow triggers on multiple events, you must configure each event separately. on: push: branches: - main - 'releases/**' Using activity types and filters with multiple events Some events have filters that give you more control over when your workflow should run.įor example, the push event has a branches filter that causes your workflow to run only when a push to a branch that matches the branches filter occurs, instead of when any push occurs. on: issue: types: - opened - labeledįor more information about each event and their activity types, see " Events that trigger workflows." Using filters If an issue with two labels is opened, three workflow runs will start: one for the issue opened event and two for the two issue labeled events. For example, the following workflow triggers when an issue is opened or labeled. If multiple triggering event activity types for your workflow occur at the same time, multiple workflow runs will be triggered. If you specify multiple activity types, only one of those event activity types needs to occur to trigger your workflow. If you specify the created activity type for the label event, your workflow will run when a label is created but not when a label is edited or deleted. If your workflow triggers on the label event, it will run whenever a label is created, edited, or deleted. Use on.types to define the type of event activity that will trigger a workflow run.įor example, the issue_comment event has the created, edited, and deleted activity types. Some events have activity types that give you more control over when your workflow should run. If multiple triggering events for your workflow occur at the same time, multiple workflow runs will be triggered. If you specify multiple events, only one of those events needs to occur to trigger your workflow. For example, a workflow with the following on value will run when a push is made to any branch in the repository or when someone forks the repository: on: You can specify a single event or multiple events. Using a single eventįor example, a workflow with the following on value will run when a push is made to any branch in the workflow's repository: on: push Using multiple events These options are described in the following sections. You can also restrict the execution of a workflow to only occur for specific files, tags, or branch changes. You can define single or multiple events that can a trigger workflow, or set a time schedule. For a list of available events, see " Events that trigger workflows." To automatically trigger a workflow, use on to define which events can cause the workflow to run. If you omit name, GitHub sets it to the workflow file path relative to the root of the repository. GitHub displays the names of your workflows on your repository's actions page. github/workflows directory of your repository. If you're new to YAML and want to learn more, see " Learn YAML in Y minutes." Workflow files use YAML syntax, and must have either a.