From d00932beddc2b0c1f59cbdc56e803780126866fb Mon Sep 17 00:00:00 2001 From: lonix1 <40320097+lonix1@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:03:03 +0200 Subject: [PATCH] docs: clearer explanation for globs in when:path (#2252) As discussed on [discord](https://discord.com/channels/838698813463724034/838698813463724037/1142646908049961001). --- .../version-1.0/20-usage/20-pipeline-syntax.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/versioned_docs/version-1.0/20-usage/20-pipeline-syntax.md b/docs/versioned_docs/version-1.0/20-usage/20-pipeline-syntax.md index 6e632a106..dd8bc6f55 100644 --- a/docs/versioned_docs/version-1.0/20-usage/20-pipeline-syntax.md +++ b/docs/versioned_docs/version-1.0/20-usage/20-pipeline-syntax.md @@ -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: