Skip to content

Commit b9c0dca

Browse files
Document merge_group branch filters
1 parent e6d7d66 commit b9c0dca

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

content/actions/reference/workflows-and-actions/workflow-syntax.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,34 @@ run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }}
7272

7373
{% data reusables.actions.workflows.triggering-workflow-branches4 %}
7474

75+
## `on.merge_group.<branches|branches-ignore>`
76+
77+
When using the `merge_group` event, you can configure a workflow to run only for merge groups that target specific branches.
78+
79+
Use the `branches` filter when you want to include branch name patterns. Use the `branches-ignore` filter when you only want to exclude branch name patterns. You cannot use both the `branches` and `branches-ignore` filters for the same event in a workflow.
80+
81+
The `branches` and `branches-ignore` keywords accept glob patterns that use characters like `*`, `**`, `+`, `?`, `!` and others to match more than one branch name. If a name contains any of these characters and you want a literal match, escape each of these special characters with `\`. For more information about glob patterns, see the [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet).
82+
83+
### Example: Including branches for merge groups
84+
85+
```yaml
86+
on:
87+
merge_group:
88+
branches:
89+
- main
90+
- 'releases/**'
91+
```
92+
93+
### Example: Excluding branches for merge groups
94+
95+
```yaml
96+
on:
97+
merge_group:
98+
branches-ignore:
99+
- 'mona/octocat'
100+
- 'releases/**-alpha'
101+
```
102+
75103
## `on.push.<branches|tags|branches-ignore|tags-ignore>`
76104

77105
{% data reusables.actions.workflows.run-on-specific-branches-or-tags1 %}

0 commit comments

Comments
 (0)