Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve explanation for globs in when:path #2252

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions docs/versioned_docs/version-1.0/20-usage/20-pipeline-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down