1
0
mirror of synced 2025-12-22 03:16:52 -05:00

Mention on the use of square brackets in GitHub Actions workflows filter patterns (#18970)

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
This commit is contained in:
Noritada Kobayashi
2022-08-22 15:29:27 +09:00
committed by GitHub
parent b9c83ca384
commit f55237c549

View File

@@ -1037,15 +1037,23 @@ You can use special characters in path, branch, and tag filters.
- `[]` Matches one character listed in the brackets or included in ranges. Ranges can only include `a-z`, `A-Z`, and `0-9`. For example, the range`[0-9a-z]` matches any digit or lowercase letter. For example, `[CB]at` matches `Cat` or `Bat` and `[1-2]00` matches `100` and `200`.
- `!`: At the start of a pattern makes it negate previous positive patterns. It has no special meaning if not the first character.
The characters `*`, `[`, and `!` are special characters in YAML. If you start a pattern with `*`, `[`, or `!`, you must enclose the pattern in quotes.
The characters `*`, `[`, and `!` are special characters in YAML. If you start a pattern with `*`, `[`, or `!`, you must enclose the pattern in quotes. Also, if you use a [flow sequence](https://yaml.org/spec/1.2.2/#flow-sequences) with a pattern containing `[` and/or `]`, the pattern must be enclosed in quotes.
```yaml
# Valid
- '**/README.md'
branches:
- '**/README.md'
# Invalid - creates a parse error that
# prevents your workflow from running.
- **/README.md
branches:
- **/README.md
# Valid
branches: [ main, 'release/v[0-9].[0-9]' ]
# Invalid - creates a parse error
branches: [ main, release/v[0-9].[0-9] ]
```
For more information about branch, tag, and path filter syntax, see "[`on.<push>.<branches|tags>`](#onpushbranchestagsbranches-ignoretags-ignore)", "[`on.<pull_request>.<branches|tags>`](#onpull_requestpull_request_targetbranchesbranches-ignore)", and "[`on.<push|pull_request>.paths`](#onpushpull_requestpull_request_targetpathspaths-ignore)."