Skip to content

Commit 0c7c2d9

Browse files
committed
added describe pr filter
1 parent 4d57578 commit 0c7c2d9

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

docs/filter-functions.md

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ The following functions are supported in addition to the built-in functions prov
1818

1919
<div class="big-summary" markdown=1>
2020

21-
| Function | Input | Args | Output |
22-
| -------------------------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------- | ---------------------- |
23-
| [`capture`](#capture)<br />Find and return the first occurrence of a regex in the input string | String | `regex` | String |
24-
| [`difference`](#difference)<br />Given two lists, keep only items that are in the 1st list but not in the 2nd. | [Objects] | `list` | [Objects] |
25-
| [`every`](#every)<br />Checks whether all element in the list are `true` | [Bool] | - | Bool |
26-
| [`filter`](#filter)<br />Reduce list of items into a list of same items that match the specified term | [String]<br />[Object] | `regex`, `term`, `list`, `attr` | [String]<br />[Object] |
27-
| [`includes`](#match)<br />Check if substring match | String | `regex`, `term`, `list` | Bool |
28-
| [`intersection`](#intersection)<br />Given two lists, keep only items that are in both lists. | [Objects] | `list` | [Objects] |
29-
| [`map`](#map)<br />Maps each object in a list into their specified attribute value | [Object] | `attr` | [Object] |
30-
| [`match`](#match)<br />Maps list of items into a list of booleans that match the specified term | [String]<br />[Object] | `regex`, `term`, `list` `attr` | [Bool] |
31-
| [`nope`](#nope)<br />Checks whether all element in the list are `false` | [Bool] | - | Bool |
32-
| [`reject`](#reject)<br />Inverse of [`filter`](#filter), the result list contains non-matching items | [String]<br />[Object] | `regex`, `term`, `list`, `attr` | [String]<br />[Object] |
33-
| [`some`](#some)<br />Checks whether at least one element in the list is `true` | [Bool] | - | Bool |
21+
| Function | Input | Args | Output |
22+
| --------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------- | ---------------------- |
23+
| [`capture`](#capture)<br />Find and return the first occurrence of a regex in the input string | String | `regex` | String |
24+
| [`difference`](#difference)<br />Given two lists, keep only items that are in the 1st list but not in the 2nd. | [Objects] | `list` | [Objects] |
25+
| [`every`](#every)<br />Checks whether all element in the list are `true` | [Bool] | - | Bool |
26+
| [`filter`](#filter)<br />Reduce list of items into a list of same items that match the specified term | [String]<br />[Object] | `regex`, `term`, `list`, `attr` | [String]<br />[Object] |
27+
| [`includes`](#match)<br />Check if substring match | String | `regex`, `term`, `list` | Bool |
28+
| [`intersection`](#intersection)<br />Given two lists, keep only items that are in both lists. | [Objects] | `list` | [Objects] |
29+
| [`map`](#map)<br />Maps each object in a list into their specified attribute value | [Object] | `attr` | [Object] |
30+
| [`match`](#match)<br />Maps list of items into a list of booleans that match the specified term | [String]<br />[Object] | `regex`, `term`, `list` `attr` | [Bool] |
31+
| [`nope`](#nope)<br />Checks whether all element in the list are `false` | [Bool] | - | Bool |
32+
| [`reject`](#reject)<br />Inverse of [`filter`](#filter), the result list contains non-matching items | [String]<br />[Object] | `regex`, `term`, `list`, `attr` | [String]<br />[Object] |
33+
| [`some`](#some)<br />Checks whether at least one element in the list is `true` | [Bool] | - | Bool |
3434

3535

3636
</div>
@@ -41,7 +41,7 @@ The following functions are supported in addition to the built-in functions prov
4141

4242
| Function | Input | Args | Output |
4343
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------- | ----------------------- |
44-
| [`allDocs`](#alldocs)<br />Checks the list includes only documents | [`files`](./context-variables.md#files) | - | Bool |
44+
| [`AI_DescribePR`](#AI_DescribePR)<br />Returns an AI-generated description of the PR based on the provided input diff | Object | - | String |
4545
| [`allImages`](#allimages)<br />Checks the list includes only images | [`files`](./context-variables.md#files) | - | Bool |
4646
| [`allTests`](#alltests)<br />Checks the list includes only tests | [`files`](./context-variables.md#files) | - | Bool |
4747
| [`codeExperts`](#codeexperts)<br />Get list of contributors based on expert reviewer model results | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
@@ -339,6 +339,33 @@ In case you want to exclude more files, like all `txt` under the `requirements`
339339
{{ (files | allDocs) and (files | match(regex=r/requirements\/.*\.txt$/) | nope ) }}
340340
```
341341

342+
#### `AI_DescribePR`
343+
344+
Leverage LinearB's AI to assist with generating a concise and meaningful description for pull requests based on the provided context. Streamline the review process by summarizing the purpose and key changes in a PR, reducing the manual effort and cognitive load for developers and reviewers.
345+
346+
| **Argument** | Usage | **Type** | **Description** |
347+
| ------------ | ------ | -------- | ---------------------------------------------------------------------- |
348+
| - | Input | `Object` | The context to send to the AI for generating a description. |
349+
| - | Output | String | AI-generated description of the PR based on the provided input context |
350+
351+
Use the `AI_DescribePR` filter in a `.cm` file to append the AI-generated description to the PR description on each non-bot commit:
352+
353+
```yaml
354+
automations:
355+
add_pr_description:
356+
on:
357+
- pr_created
358+
- commit
359+
if:
360+
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
361+
run:
362+
- action: update-description@v1
363+
args:
364+
concat_mode: append
365+
description: {{ source | AI_DescribePR }}
366+
367+
```
368+
342369
#### `allImages`
343370

344371
Return `true` if the input list includes only images based on file extensions.
@@ -347,10 +374,10 @@ Image file extensions are: `svg`, `png`, `gif`.
347374

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

350-
| Argument | Usage | Type | Description |
351-
| -------- | ---------|-----------|------------------------------------------------ |
352-
| - | Input | [`files`](./context-variables.md#files) | The list of changed files with their path |
353-
| - | Output | Bool | `true` if all file extensions are of images |
377+
| Argument | Usage | Type | Description |
378+
| -------- | ------ | --------------------------------------- | ------------------------------------------- |
379+
| - | Input | [`files`](./context-variables.md#files) | The list of changed files with their path |
380+
| - | Output | Bool | `true` if all file extensions are of images |
354381

355382
</div>
356383

@@ -366,10 +393,10 @@ To identify as test the file must include the word `test` or `spec` in its name
366393

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

369-
| Argument | Usage | Type | Description |
370-
| ------ | ---------|-----------|------------------------------------------------ |
371-
| - | Input | [`files`](./context-variables.md#files) |The list of changed files with their path |
372-
| - | Output | Bool | `true` if all file tests are based on name and path |
396+
| Argument | Usage | Type | Description |
397+
| -------- | ------ | --------------------------------------- | --------------------------------------------------- |
398+
| - | Input | [`files`](./context-variables.md#files) | The list of changed files with their path |
399+
| - | Output | Bool | `true` if all file tests are based on name and path |
373400

374401
</div>
375402

0 commit comments

Comments
 (0)