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
Add support for user-based trigger filtering to control which users can
trigger automations. This enables excluding bot accounts and restricting
automations to specific team members.
Changes include: - New `triggers.include.user` and
`triggers.exclude.user` configuration - Updated matching rules and
default behavior documentation - Added user filtering examples and
common use cases - Refactored Dependabot/Renovate example to use user
filtering instead of branch patterns - Reorganized trigger documentation
with subsection headings for clarity
@@ -53,7 +53,7 @@ Triggers can be defined globally at the file level or specifically for each auto
53
53
54
54
#### `triggers` section
55
55
56
-
The `triggers` section in gitStream gives you precise control over when automations execute. It allows you to define conditions based on pull request events using `include` and `exclude` lists to specify branchand repository patterns. These lists determine which branchesor repositories trigger or bypass automation but do not affect the events initiating automations - implicit triggers remain active when using only `include` and `exclude`.
56
+
The `triggers` section in gitStream gives you precise control over when automations execute. It allows you to define conditions based on pull request events using `include` and `exclude` lists to specify branch, repository, and user patterns. These lists determine which branches, repositories, or users trigger or bypass automation but do not affect the events initiating automations - implicit triggers remain active when using only `include` and `exclude`.
57
57
58
58
Additionally, the `on` keyword defines specific events that trigger automations. It can be added at the file level (under the `triggers` section) or within individual automations for greater customization. When `on` is used, it switches from implicit to explicit triggering mode, meaning only the specified events will trigger automations. Multiple triggers can be stacked, meaning gitStream will execute the automation for each matching triggering event, allowing flexibility in defining automation behavior
59
59
@@ -65,8 +65,17 @@ Additionally, the `on` keyword defines specific events that trigger automations.
65
65
|`triggers.exclude.branch` :fontawesome-brands-github: |[String or regex]| Branches that match will not trigger the automation. |
66
66
|`triggers.include.repository`|[String or regex]| Repositories that match will trigger the automation. |
67
67
|`triggers.exclude.repository`|[String or regex]| Repositories that match will not trigger the automation. |
68
+
|`triggers.include.user` :fontawesome-brands-github: |[String or regex]| Users that match will trigger the automation. |
69
+
|`triggers.exclude.user` :fontawesome-brands-github: |[String or regex]| Users that match will not trigger the automation. |
68
70
</div>
69
71
72
+
!!! note "Default Behavior"
73
+
74
+
- Implicit triggers are the default behavior if the automation doesn't have explicit triggers configured.
75
+
- The automation runs for all branches, repositories, and users if neither include nor exclude is specified.
76
+
77
+
##### Trigger Events :fontawesome-brands-github:
78
+
70
79
The table below lists supported explicit triggers, categorized into those enabled by default and those that require manual activation.
71
80
72
81
<divclass="trigger-details"markdown=1>
@@ -94,15 +103,23 @@ If an automation block does not have the `on` parameter configured (explicit tri
94
103
!!! Note
95
104
The `on` parameter can be used within individual automation blocks, while `triggers.include` and `triggers.exclude` can only be defined at the file level.
Branch filtering allows you to control which branches can trigger automations based on branch name patterns.
109
+
97
110
**Note on Matching:**
98
111
99
-
- When using a `String` as the matching type, the values in `triggers.include.*` and `triggers.exclude.*` require exact matches. This means that the names of branches or repositories must exactly match the specified string to either trigger or prevent triggering the automation.
112
+
- When using a `String` as the matching type, the values in `triggers.include.branch` and `triggers.exclude.branch` require exact matches. This means that the names of branches must exactly match the specified string to either trigger or prevent triggering the automation.
100
113
- For more precise control, use a regular expression (regex) format: `r/REGEX_PATTERN/`.
101
114
102
-
**Default Behavior:**
115
+
##### Repository Filtering
116
+
117
+
Repository filtering allows you to control which repositories can trigger automations based on repository name patterns.
103
118
104
-
- Implicit triggers are the default behavior if the automation doesn't have explicit triggers configured.
105
-
- The automation runs for all branches and repositories if neither include nor exclude is specified.
119
+
**Note on Matching:**
120
+
121
+
- When using a `String` as the matching type, the values in `triggers.include.repository` and `triggers.exclude.repository` require exact matches. This means that the names of repositories must exactly match the specified string to either trigger or prevent triggering the automation.
122
+
- For more precise control, use a regular expression (regex) format: `r/REGEX_PATTERN/`.
106
123
107
124
**Exclude/Include prioritization**
108
125
@@ -119,6 +136,30 @@ If an automation block does not have the `on` parameter configured (explicit tri
119
136
- my_feature
120
137
```
121
138
139
+
##### User Filtering :fontawesome-brands-github:
140
+
141
+
User filtering allows you to control which users can trigger automations, enabling you to exclude bot accounts or include only specific team members. This helps reduce noise from automated tools and optimize automation quota usage.
142
+
143
+
**User Identification:**
144
+
The user is matched against the event actor:
145
+
146
+
- For commits: the commit author
147
+
- For PR creation: the PR author
148
+
- For label changes: the user who added/removed the label
149
+
- For comments: the commenter
150
+
- For approvals: the approver
151
+
152
+
**Common Use Cases:**
153
+
154
+
- **Exclude bots:** Prevent automations from running when triggered by SonarQube, Dependabot, Renovate, or security scanners
155
+
- **Include specific users:** Run automations only for specific team members or service accounts
156
+
- **Reduce noise:** Filter out automated tool activity that doesn't require gitStream processing
157
+
158
+
**Note on Matching:**
159
+
160
+
- When using a `String` as the matching type, the values in `triggers.include.user` and `triggers.exclude.user` require exact matches. This means that the names of users must exactly match the specified string to either trigger or prevent triggering the automation.
161
+
- For more precise control, use a regular expression (regex) format: `r/REGEX_PATTERN/`.
162
+
122
163
## Action-Level Execution Control
123
164
124
165
gitStream provides intelligent action-level execution control that automatically skips certain actions based on the original triggering event. This feature helps reduce noise and ensures that AI-powered and code-related actions only execute when there are actual code changes, improving efficiency across all supported providers (GitLab, Bitbucket, and GitHub).
@@ -205,10 +246,10 @@ This allows developers to get AI feedback during the coding process before marki
205
246
206
247
#### Dependabot and Renovate
207
248
208
-
For example, you can have your normal automations that help developers with their PRs and a separate automation that automates Dependabot or Renovate version bumps. Both automations serve distinctly different purposes: the first helps your developers streamline their PRs, while the other reduces developers' toil by auto-approving version bumps. You will not want to unnecessarily trigger gitStream for Dependabot or Renovate, so you can configure the triggers to exclude the branch where Dependabot or Renovate PRs are created.
249
+
For example, you can have your normal automations that help developers with their PRs and a separate automation that automates Dependabot or Renovate version bumps. Both automations serve distinctly different purposes: the first helps your developers streamline their PRs, while the other reduces developers' toil by auto-approving version bumps. You will not want to unnecessarily trigger gitStream for Dependabot or Renovate, so you can configure the triggers to exclude these bot users.
209
250
210
251
211
-
In your default automation file, you should exclude the branch where Dependabot or Renovate PRs are created:
252
+
In your default automation file, you should exclude bot users like Dependabot or Renovate:
212
253
213
254
```yaml+jinja title="gitstream.cm"
214
255
manifest:
@@ -219,8 +260,10 @@ manifest:
219
260
# (automations will still trigger on commits, PR creation, etc.)
220
261
triggers:
221
262
exclude:
222
-
branch:
223
-
- r/(Dependabot|dependabot|Renovate|renovate)/
263
+
user:
264
+
- dependabot[bot]
265
+
- renovate[bot]
266
+
- r/(bot|dependabot|renovate)/
224
267
225
268
# The default automations for developers below
226
269
automations:
@@ -240,12 +283,13 @@ And the other automations file is set to automate Dependabot PRs:
240
283
manifest:
241
284
version: 1.0
242
285
243
-
# Note: triggers.include still allows implicit triggers
286
+
# Note: triggers.include still allows implicit triggers
244
287
# However, the automations below use 'on' which switches to explicit mode
245
288
triggers:
246
289
include:
247
-
branch:
248
-
- r/(Dependabot|dependabot|Renovate|renovate)/
290
+
user:
291
+
- dependabot[bot]
292
+
- renovate[bot]
249
293
250
294
automations:
251
295
bump_minor:
@@ -326,6 +370,57 @@ automations:
326
370
gt: 10
327
371
```
328
372
373
+
#### User Filtering Examples :fontawesome-brands-github:
374
+
375
+
Exclude specific bot users from triggering automations while allowing all other users:
376
+
377
+
```yaml+jinja title="exclude-bots.cm"
378
+
manifest:
379
+
version: 1.0
380
+
381
+
# Exclude bot users from triggering automations
382
+
triggers:
383
+
exclude:
384
+
user:
385
+
- sonar
386
+
- dependabot[bot]
387
+
- renovate[bot]
388
+
- r/(bot|scanner)/
389
+
390
+
automations:
391
+
review_requirements:
392
+
if:
393
+
- true
394
+
run:
395
+
- action: set-required-approvals@v1
396
+
args:
397
+
approvals: 2
398
+
```
399
+
400
+
Include only specific team members for sensitive automations:
401
+
402
+
```yaml+jinja title="team-only.cm"
403
+
manifest:
404
+
version: 1.0
405
+
406
+
# Only allow specific team members to trigger these automations
407
+
triggers:
408
+
include:
409
+
user:
410
+
- john-doe
411
+
- jane-smith
412
+
- r/team-lead-.*/
413
+
414
+
automations:
415
+
security_review:
416
+
if:
417
+
- {{ files | match(regex=r/\.(env|key|pem)$/) | some }}
418
+
run:
419
+
- action: add-label@v1
420
+
args:
421
+
label: security-review-required
422
+
```
423
+
329
424
#### Branch regex pattern
330
425
331
426
Trigger only specific automations branch pattern A, and trigger other automation for all other branches except those that fit the pattern REGEX_PATTERN.
0 commit comments