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
4 changes: 4 additions & 0 deletions docs/automation-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ automations:

For more information about the `codeExperts` filter function, see the [filter functions documentation](https://docs.gitstream.cm/filter-functions/#codeexperts).

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

#### `merge` :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:

Once triggered, merge the PR if possible. It can be set to wait for all checks to pass or only required ones.
Expand Down
53 changes: 47 additions & 6 deletions docs/cm-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,13 @@ The manifest version field is used to parse the `.cm` file, in the future if bre

The `config` section in the `.cm` file is optional and specifies settings that affect gitStream's operation within a given context.

| Key | Type | Default | Scope | Description |
| --------------------- | ---------------- | ------- | -------------- | ----------------------------------------------------------------------------------- |
| `config` | Map | - | per `.cm` file | Root configuration section, applies to the automations defined in the current file. |
| `config.admin.users` | [String] | `[]` | `gitstream.cm` | List of admin users, identified by Git provider usernames. |
| `config.ignore_files` | [String] | `[]` | per `.cm` file | Files to exclude from consideration. |
| `config.user_mapping` | [String: String] | `[]` | per `.cm` file | Map Git user details to provider account names. |
| Key | Type | Default | Scope | Description |
| ------------------------ | ---------------- | ------- | -------------- | ----------------------------------------------------------------------------------- |
| `config` | Map | - | per `.cm` file | Root configuration section, applies to the automations defined in the current file. |
| `config.admin.users` | [String] | `[]` | `gitstream.cm` | List of admin users, identified by Git provider usernames. |
| `config.git_history_since` | String | - | per `.cm` file | Limit git history analysis to commits after the specified date (YYYY-MM-DD). |
| `config.ignore_files` | [String] | `[]` | per `.cm` file | Files to exclude from consideration. |
| `config.user_mapping` | [String: String] | `[]` | per `.cm` file | Map Git user details to provider account names. |

##### `config.admin.users`

Expand Down Expand Up @@ -247,6 +248,46 @@ On the other hand, when using `explainRankByGitBlame` with `add-comment@v1` it s
1. `rankByGitBlame` will drop `null` users
2. `explainRankByGitBlame` will NOT drop `null` users

##### `config.git_history_since`

The `config.git_history_since` configuration limits how far back gitStream looks in git history when analyzing code expertise and git blame results. This affects filters and actions that rely on git history analysis, including:

- `codeExperts` filter
- `rankByGitBlame` filter
- `explainRankByGitBlame` filter
- `explain-code-experts` action

When `git_history_since` is configured, gitStream will only consider commits made on or after the specified date when determining code experts and calculating git blame rankings. This is particularly useful for:

- **Team transitions**: When a project changes hands between teams, you can set the date to when the new team took over to ensure only current team members are suggested as reviewers
- **Performance optimization**: Large repositories with extensive history can benefit from limiting the analysis scope
- **Relevant expertise**: Focus on recent contributions rather than legacy code changes

The value should be specified as a date in `YYYY-MM-DD` format.

```yaml title="example"
config:
git_history_since: '2025-01-01' # Only consider commits from January 1, 2025 onwards
```

**Example use case**: If your team took over a project on January 1, 2025, and you want to ensure that only current team members are suggested as code experts:

```yaml title=".cm/gitstream.cm"
config:
git_history_since: '2025-01-01'

automations:
assign_code_experts:
if:
- {{ files | codeExperts(gt=10) | length > 0 }}
run:
- action: add-reviewers@v1
args:
reviewers: {{ files | codeExperts(gt=10) }}
```

With this configuration, the `codeExperts` filter will only analyze git blame data from commits made on or after January 1, 2025, effectively filtering out previous team members from reviewer suggestions.

#### `triggers`

The `triggers` is section specifies when automations are executed, supporting `include` and `exclude` lists for branch and repository patterns at the file level. The `on` keyword can also be used within individual automations to define specific events that trigger those automations.
Expand Down
4 changes: 4 additions & 0 deletions docs/filter-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ automations:
reviewers: {{ repo | codeExperts(gt=10) }}
```

!!! 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`

Decode Base64 encoded string into an object. Encoded strings are formatted: `"base64: <encoded_string>"`
Expand Down