Skip to content

Commit 26ae5df

Browse files
authored
Update Execution Model Documentation for Action-Level Control (#756)
Add comprehensive documentation for gitStream's action-level execution control, explaining how and when specific actions are automatically skipped based on triggering events.
1 parent fa799a6 commit 26ae5df

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

docs/execution-model.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,70 @@ If an automation block does not have explicit triggers configured, it will be tr
8282
!!! Note
8383
The `on` parameter can be used within individual automation blocks, while `triggers.include` and `triggers.exclude` can only be defined at the file level.
8484

85+
## Action-Level Execution Control
86+
87+
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).
88+
89+
### How It Works
90+
91+
When an automation is triggered, gitStream evaluates each action individually against the original triggering event. Some actions are automatically skipped if the triggering event is not relevant to their purpose.
92+
93+
!!! important "Explicit Triggers Override"
94+
When explicit triggers are configured (using the `on` or `triggers` parameters), they take precedence over the automatic skip mechanism. This means actions will execute for all explicitly defined triggers, regardless of the action-level execution rules below.
95+
96+
### Action Execution Rules
97+
98+
The following table shows which actions are restricted to code-related triggering events:
99+
100+
<div class="trigger-details" markdown=1>
101+
| Action | Executes Only On | Behavior on Other Triggers |
102+
| --------------------- | ---------------------------------------------------------- | -------------------------- |
103+
| `add-code-comment` | Commit pushed, Creating a PR (not draft), PR ready for review | Skipped |
104+
| `code-review` | Commit pushed, Creating a PR (not draft), PR ready for review | Skipped |
105+
| `describe-changes` | Commit pushed, Creating a PR (not draft), PR ready for review | Skipped |
106+
| `explain-code-experts`| Commit pushed, Creating a PR (not draft), PR ready for review | Skipped |
107+
| All other actions | Current defaults (no restrictions) | Executed |
108+
</div>
109+
110+
### Examples
111+
112+
#### Scenario: AI Code Review with Explicit Triggers
113+
114+
```yaml+jinja
115+
automations:
116+
ai_code_review:
117+
on:
118+
- commit
119+
- label_added
120+
if:
121+
- true
122+
run:
123+
- action: code-review@v1 # Executes on both commit and label_added (explicit triggers override skip rules)
124+
- action: add-label@v1 # Executes on both commit and label_added
125+
args:
126+
label: "reviewed"
127+
```
128+
129+
In this example with explicit triggers:
130+
- When triggered by a `commit` event: both actions execute
131+
- When triggered by a `label_added` event: both actions execute (explicit triggers take precedence)
132+
133+
#### Scenario: No Explicit Triggers
134+
135+
```yaml+jinja
136+
automations:
137+
smart_review:
138+
if:
139+
- {{ files | length > 5 }}
140+
run:
141+
- action: describe-changes@v1 # Only executes on code-related events
142+
- action: add-reviewers@v1 # Executes on all default triggers
143+
args:
144+
reviewers: ["expert1", "expert2"]
145+
```
146+
147+
With implicit triggers (no explicit triggers configured), `describe-changes` will only execute when the automation is triggered by code changes, while `add-reviewers` follows the current default behavior.
148+
85149
**Note on Matching:**
86150

87151
- 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.

0 commit comments

Comments
 (0)