docs: clearer explanation for globs in when:path (#2252)

As discussed on [discord](https://discord.com/channels/838698813463724034/838698813463724037/1142646908049961001).
This commit is contained in:
lonix1 2023-08-20 15:03:03 +02:00 committed by GitHub
parent 008a8c6acb
commit d00932bedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -423,14 +423,21 @@ Path conditions are applied only to **push** and **pull_request** events.
It is currently **only available** for GitHub, GitLab and Gitea (version 1.18.0 and newer)
:::
Execute a step only on a pipeline with certain files being changed:
Execute a step only when certain files were changed:
```yaml
when:
- path: "src/*"
- path: "src/*.js"
```
You can use [glob patterns](https://github.com/bmatcuk/doublestar#patterns) to match the changed files and specify if the step should run if a file matching that pattern has been changed `include` or if some files have **not** been changed `exclude`.
One can also use [glob patterns](https://github.com/bmatcuk/doublestar#patterns):
```yaml
when:
- path: "src/**/*.js"
```
To match whether the files have been changed or not changed, use `include` or `exclude` respectively:
```yaml
when: