You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/guide/matchingevents.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -375,6 +375,31 @@ This example will match modified files with the name of test.go:
375
375
files.modified.exists(x, x.matches('test.go'))
376
376
```
377
377
378
+
### Filtering PipelineRuns to exclude non-code changes
379
+
380
+
This example demonstrates how to filter `pull_request` events to exclude changes that only affect documentation, configuration files, or other non-code files. This is useful when you want to run tests only when actual code changes occur:
* Only match `pull_request` events targeting the `main` branch
392
+
* **Exclude** the PipelineRun if all changed files match any of the following patterns:
393
+
* Files in the `docs/` directory (`^docs/`)
394
+
* Markdown files (`\\.md$`)
395
+
* Common repository metadata files (`\\.gitignore`, `OWNERS`, `PROJECT`, `LICENSE`)
396
+
397
+
The `!files.all.all(x, x.matches('pattern1') || x.matches('pattern2') || ...)` syntax means "not all files match any of these patterns", which effectively means "trigger only if at least one file doesn't match the exclusion patterns" (i.e., there are meaningful code changes).
398
+
399
+
{{< hint warning >}}
400
+
**Important**: When using regex patterns in CEL expressions, remember to properly escape special characters. The backslash (`\`) needs to be doubled (`\\`) to escape properly within the CEL string context. Using logical OR (`||`) operators within the `matches()` function is more reliable than combining patterns with pipe (`|`) characters in a single regex.
401
+
{{< /hint >}}
402
+
378
403
### Matching PipelineRun to an event (commit, pull_request) title
379
404
380
405
This example will match all pull requests starting with the title `[DOWNSTREAM]`:
IMPORTANT: You can ONLY suggest labels from this list of available labels in the repository:
132
132
{labels_text}
133
133
134
-
Based on the PR title, description, files changed, and commit messages, suggest 2-4 relevant labels from the available labels list above. Use the label descriptions to understand their intended purpose.
134
+
Based on the PR title, description, files changed, and commit messages, suggest up to 3 relevant labels from the available labels list above. Use the label descriptions to understand their intended purpose.
135
+
136
+
IMPORTANT RESTRICTIONS:
137
+
- Only suggest "documentation" label if files in the docs/ directory are modified
138
+
- Only suggest "e2e" label if files in the test/ directory are modified for e2e tests
139
+
- Only suggest provider labels ("github", "gitlab", "bitbucket", "gitea") if files in the pkg/provider/ directory are modified
140
+
- Provider labels should match the specific provider subdirectory modified (e.g., "github" only if pkg/provider/github/ files are changed)
141
+
- Maximum 3 labels total
135
142
136
143
Respond with only a JSON array of label names that exist in the available labels list, like: ["enhancement", "backend"]
0 commit comments