Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ Auto-merge Dependabot PRs

=== "By Release Type"

!!! warning "Required gitStream Plugins"
This example requires you to install the [`extractDependabotVersionBump`](/filter-function-plugins/#extractdependabotversionbump) and [`compareSemver`](/filter-function-plugins/#comparesemver) plugins.

[Learn more about gitStream plugins](/plugins/).

!!! info "Configuration Description"

Conditions (all must be true):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ automations:
comment: |
Dependabot `patch` version bumps are approved and merged automatically.

bump: {{ pr.description | extractDependabotVersionBump | compareSemver }}
bump: {{ pr.description | checkDependabot | checkSemver }}
4 changes: 1 addition & 3 deletions docs/execution-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ This allows developers to get AI feedback during the coding process before marki

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.

!!! warning "Required gitStream Plugins"
This example requires you to install the [`extractDependabotVersionBump`](/filter-function-plugins/#extractdependabotversionbump) and [`compareSemver`](/filter-function-plugins/#comparesemver) plugins.

In your default automation file, you should exclude the branch where Dependabot or Renovate PRs are created:

Expand Down Expand Up @@ -270,7 +268,7 @@ automations:
comment: |
Dependabot `patch` version bumps are approved and merged automatically.

bump: {{ pr.description | extractDependabotVersionBump | compareSemver }}
bump: {{ pr.description | checkDependabot | checkSemver }}
```

#### Assign code expert
Expand Down
10 changes: 8 additions & 2 deletions docs/filter-function-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ JavaScript plugins that enable custom filter functions for gitStream. To learn h

--8<-- "plugins/filters/compareMultiSemver/README.md"

--8<-- "plugins/filters/compareSemver/README.md"
## compareSemver
!!! note "compareSemver → checkSemver"

--8<-- "plugins/filters/extractDependabotVersionBump/README.md"
This plugin is now supported by a native filter function [`checkSemver`](/filter-functions/#checksemver). The native implementation provides better performance and doesn't require plugin installation.

## extractDependabotVersionBump
!!! note "extractDependabotVersionBump → checkDependabot"

This plugin is now supported by a native filter function [`checkDependabot`](/filter-functions/#checkdependabot). The native implementation provides better performance and doesn't require plugin installation.

--8<-- "plugins/filters/extractRenovateVersionBump/README.md"

Expand Down
91 changes: 90 additions & 1 deletion docs/filter-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ The following functions are supported in addition to the built-in functions prov
| [`allDocs`](#alldocs)<br />Checks the list includes only images | [`files`](./context-variables.md#files) | - | Bool |
| [`allImages`](#allimages)<br />Checks the list includes only images | [`files`](./context-variables.md#files) | - | Bool |
| [`allTests`](#alltests)<br />Checks the list includes only tests | [`files`](./context-variables.md#files) | - | Bool |
| [`checkDependabot`](#checkdependabot)<br />Extract version bump information from Dependabot PRs description | String - PR description | - | [String] |
| [`checkSemver`](#checksemver)<br />Compare two software version numbers and determine the type of version change | [String] - Array with [to, from] versions | `lexicographical`, `zeroExtend` | String |
| [`codeExperts`](#codeexperts)<br />Get list of contributors based on expert reviewer model results | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
| [`decode`](#decode)<br />Decode Base64 encoded string into an object | String (Base64 encoded) | - | Object |
| [`encode`](#encode)<br />Encode data into Base64 encoded string | Object | - | String (Base64 encoded) |
Expand Down Expand Up @@ -379,6 +381,93 @@ To identify as test the file must include the word `test` or `spec` in its name
{{ files | allTests }}
```


#### `checkDependabot`

Extract version bump information from Dependabot PRs description. This filter parses Dependabot PR descriptions to identify version changes and returns an array containing the "to" and "from" versions.

<div class="filter-details" markdown=1>

| Argument | Usage | Type | Description |
| -------- | ------ | ------ | ------------------------------------------------------------------- |
| - | Input | String | The PR description from a Dependabot pull request |
| - | Output | [String] | Array with [to, from] versions, or null if no version info found |

</div>

Examples:

Check if a Dependabot PR is a minor version bump and auto-approve:

```yaml+jinja
automations:
auto_approve_dependabot_minor:
if:
- {{ pr.description | checkDependabot | checkSemver == 'minor' }}
- {{ branch.name | includes(term="dependabot") }}
- {{ branch.author | includes(term="dependabot") }}
run:
- action: approve@v1
- action: add-comment@v1
args:
comment: |
Dependabot minor version bump approved automatically.
```

Auto-merge patch updates:

```yaml+jinja
automations:
auto_merge_dependabot_patch:
if:
- {{ pr.description | checkDependabot | checkSemver == 'patch' }}
- {{ branch.name | includes(term="dependabot") }}
run:
- action: approve@v1
- action: merge@v1
```

#### `checkSemver`

Compare two software version numbers and determine the type of version change. This filter takes an array of two version strings and returns the type of change between them.

<div class="filter-details" markdown=1>

| Argument | Usage | Type | Description |
| -------- | ------ | ------ | ------------------------------------------------------------------- |
| - | Input | [String] | Array with [to, from] versions in semver format |
| `lexicographical` | Input (optional) | Boolean | Compare lexicographically instead of naturally (default: false) |
| `zeroExtend` | Input (optional) | Boolean | Pad shorter version with zeros (default: true) |
| - | Output | String | Returns 'major', 'minor', 'patch', 'downgrade', 'equal', or 'error' |

</div>

Examples:

Compare version arrays directly:

```yaml+jinja
{{ ["1.2.3", "1.2.1"] | checkSemver }} # Returns "patch"
```

Use with Dependabot to classify version bumps:

```yaml+jinja
bump_type: {{ pr.description | checkDependabot | checkSemver }}

automations:
handle_major_bump:
if:
- {{ bump_type == 'major' }}
run:
- action: add-label@v1
args:
label: "major-version-bump"
- action: request-changes@v1
args:
comment: "Major version bumps require manual review"
```

#### `codeExperts`

When requesting a review for a pull request, it's important to select a reviewer who has a deep understanding of the relevant code area, the domain problem, and the framework being used. This ensures that the reviewer can provide specific and informed feedback, rather than general comments that may not take into account the context in which the issue was solved.
Expand Down Expand Up @@ -416,7 +505,7 @@ automations:
```

!!! tip "Limit git history for code experts"

Use the [`config.git_history_since`](./cm-file.md#configgit_history_since) configuration to limit the git history analysis to commits after a specific date. This is useful for team transitions or when you want to focus on recent contributors only.

#### `decode`
Expand Down
10 changes: 5 additions & 5 deletions plugins/filters/compareSemver/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## compareSemver
Compares two software version numbers (e.g., "1.2.1" or "1.2b") and determines the type of version change.
The first version to be compared, and the second are passed as argument 1 and 2 or as array of 2 items.
The first version to be compared, and the second are passed as argument 1 and 2 or as array of 2 items.
When V1 > V2 the it means and upgrade.

**Returns**: <code>string</code> - It returns a string of either:
Expand All @@ -11,16 +11,16 @@ When V1 > V2 the it means and upgrade.
'patch' if the patch version is incremented.
'downgrade' if the second version is lower than the first.
'equal' if both versions are equal.
'error' if the comparison is abnormal or cannot be determined.
**License**: MIT
'error' if the comparison is abnormal or cannot be determined.
**License**: MIT

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| versions | <code>Array.&lt;string&gt;</code> | | V1 and V2 in Semver format |
| [lexicographical] | <code>boolean</code> | <code>false</code> | compares each part of the version strings lexicographically instead of naturally; this allows suffixes such as "b" or "dev" but will cause "1.10" to be considered smaller than "1.2". |
| [zeroExtend] | <code>boolean</code> | <code>true</code> | changes the result if one version string has less parts than the other. In this case the shorter string will be padded with "zero" parts instead of being considered smaller. |

**Example**
**Example**
```js
{{ ["1.2.1", "1.2.3"] | compareSemver == "patch" }}
{{ ["1.2.3", "1.2.1"] | compareSemver == "patch" }}
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example shows using compareSemver but the documentation indicates this has been replaced by checkSemver. The example should be updated to use the new native function name.

Suggested change
{{ ["1.2.3", "1.2.1"] | compareSemver == "patch" }}
{{ ["1.2.3", "1.2.1"] | checkSemver == "patch" }}

Copilot uses AI. Check for mistakes.
```
21 changes: 0 additions & 21 deletions plugins/filters/extractDependabotVersionBump/LICENSE

This file was deleted.

22 changes: 0 additions & 22 deletions plugins/filters/extractDependabotVersionBump/README.md

This file was deleted.

This file was deleted.

36 changes: 0 additions & 36 deletions plugins/filters/extractDependabotVersionBump/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions plugins/filters/extractDependabotVersionBump/reference.md

This file was deleted.

Loading