1
0
mirror of synced 2025-12-30 03:01:36 -05:00
Files
docs/data/reusables/actions/workflows/triggering-workflow-branches4.md

19 lines
1.1 KiB
Markdown

You cannot use `branches` and `branches-ignore` to filter the same event in a single workflow. If you want to both include and exclude branch patterns for a single event, use the `branches` filter along with the `!` character to indicate which branches should be excluded.
If you define a branch with the `!` character, you must also define at least one branch without the `!` character. If you only want to exclude branches, use `branches-ignore` instead.
The order that you define patterns matters.
* A matching negative pattern (prefixed with `!`) after a positive match will exclude the Git ref.
* A matching positive pattern after a negative match will include the Git ref again.
The following workflow will run on `pull_request` events for pull requests that target `releases/10` or `releases/beta/mona`, but not for pull requests that target `releases/10-alpha` or `releases/beta/3-alpha` because the negative pattern `!releases/**-alpha` follows the positive pattern.
```yaml
on:
pull_request:
branches:
- 'releases/**'
- '!releases/**-alpha'
```