Skip to content

Commit 385cab1

Browse files
authored
Merge pull request #661 from linear-b/add-code-review-action
Add code review action
2 parents e57c64a + da1dd4a commit 385cab1

File tree

8 files changed

+215
-7
lines changed

8 files changed

+215
-7
lines changed

docs/automation-actions.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ For all other actions, gitStream executes the actions in the order they are list
2929
- [`add-thread`](#add-thread) :fontawesome-brands-gitlab:
3030
- [`approve`](#approve) :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
3131
- [`close`](#close) :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
32+
- [`code-review`](#code-review) :fontawesome-brands-github: <!-- :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket: -->
3233
- [`explain-code-experts`](#explain-code-experts) :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
3334
- [`merge`](#merge) :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
3435
- [`request-changes`](#request-changes) :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
@@ -302,6 +303,36 @@ automations:
302303
- action: close@v1
303304
```
304305

306+
#### `code-review` :fontawesome-brands-github: <!-- >:fontawesome-brands-gitlab: :fontawesome-brands-bitbucket: -->
307+
308+
This action, once triggered, reviews the code in the PR, and generates a comment with the identified issue, bugs, misconfigurations, and bad practices in the newly introduced code, with an option to approve the PR if no issues were found.
309+
310+
<div class="filter-details" markdown=1>
311+
312+
| Args | Usage | Type | Description |
313+
| -----------|------|-----|------------------------------------------------ |
314+
| `approve_on_LGTM` | Optional | Bool | Approve this PR if no issues were found. Default is `false` |
315+
316+
```yaml+jinja title="example"
317+
automations:
318+
linearb_ai_review:
319+
on:
320+
- pr_created
321+
- commit
322+
if:
323+
- {{ not pr.draft }}
324+
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
325+
run:
326+
- action: code-review@v1
327+
args:
328+
approve_on_LGTM: {{ APPROVE_PR_ON_LGTM }} # optional arg, you can remove it
329+
...
330+
...
331+
# Define variables
332+
333+
APPROVE_PR_ON_LGTM: false # Add conditions for PR approvals. For example - allow approval only for specific users
334+
```
335+
305336
#### `merge` :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
306337

307338
Once triggered, merge the PR if possible. It can be set to wait for all checks to pass or only required ones.
Loading
Lines changed: 91 additions & 0 deletions
Loading
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Automation - Code Review Using LinearB's AI
3+
description: Use gitStream's integration with LinearB's AI service to automate code reviews.
4+
category: [quality, genai, copilot, tests, efficiency]
5+
starter_kits: [genai]
6+
---
7+
# Code Review Using LinearB's AI :material-star-circle:
8+
9+
<!-- --8<-- [start:example]-->
10+
Use LinearB's AI with the `code-review` action to automatically review the introduced changes to the code.
11+
12+
![code-review](/automations/integrations/LinearBAI/describe-pr/LinearB-AI-code-review.png)
13+
14+
!!! info "Configuration Description"
15+
16+
Conditions (all must be true):
17+
18+
* A PR is created or new code has been committed to the PR.
19+
* The PR is not on Draft staten and was not created by a bot.
20+
21+
Automation Actions:
22+
23+
* Perform an AI-driven code review and append the review comments to the PR.
24+
25+
!!! example "Configuration Example"
26+
```yaml+jinja
27+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review.cm"
28+
```
29+
<div class="result" markdown>
30+
<span>
31+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review.cm){ .md-button }
32+
</span>
33+
</div>
34+
<!-- --8<-- [end:example]-->
35+
36+
## Additional Resources
37+
38+
--8<-- "docs/snippets/general.md"
39+
40+
**Related Automations**:
41+
42+
--8<-- "docs/snippets/context-automation.md"
43+
44+
--8<-- "docs/snippets/automation-footer.md"

docs/automations/integrations/LinearBAI/describe-pr/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ starter_kits: [genai]
99
<!-- --8<-- [start:example]-->
1010
Use the `AI_DescribePR` filter to automatically generate and append a concise, AI-generated description to a pull request. This ensures that all PRs include meaningful and helpful descriptions, improving review efficiency.
1111

12-
!!! note "Premium Feature"
13-
This automation uses LinearB’s AI service and is available exclusively for paid accounts.
14-
15-
If you’re interested in unlocking this feature, [contact our sales team](https://linearb.io/book-a-demo).
16-
1712
![summarized-pr](/automations/integrations/LinearBAI/describe-pr/LinearB-AI-describe-pr.png)
1813

1914
!!! info "Configuration Description"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
manifest:
2+
version: 1.0
3+
4+
automations:
5+
linearb_ai_review:
6+
on:
7+
- pr_created
8+
- commit
9+
if:
10+
- {{ pr.draft == false }}
11+
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
12+
run:
13+
- action: code-review@v1
14+
args:
15+
approve_on_LGTM: {{ APPROVE_PR_ON_LGTM }} # optional arg, you can remove it
16+
....
17+
...
18+
APPROVE_PR_ON_LGTM: false # you can add conditions for PR approvals. For example - allowing approvals only for specific users

docs/integrations/LB_AI.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Integrate gitStream with LinearB's AI
3+
description: Enhance your pull request experience by integrating with LinearB's AI services
4+
category: [quality, genai, copilot, tests, efficiency]
5+
---
6+
# Integrate gitStream with LinearB's AI :material-star-circle:
7+
8+
<!-- --8<-- [start:examples]-->
9+
10+
## Add PR Description Using LinearB's AI :material-star-circle:
11+
12+
--8<-- "docs/automations/integrations/LinearBAI/describe-pr/README.md:example"
13+
14+
## Use LinearB's AI for a comprehensive Code Review :material-star-circle:
15+
16+
--8<-- "docs/automations/integrations/LinearBAI/code-review/README.md:example"
17+
18+
19+
## Additional Resources
20+
21+
--8<-- "docs/snippets/general.md"
22+
23+
--8<-- "docs/snippets/automation-footer.md"

docs/integrations/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ visible: false
99

1010
<div class="integrations-card" markdown="1">
1111
<div class="integrations-card-title" markdown="1">
12-
[:fontawesome-solid-wand-magic-sparkles: AI](/integrations/askAI)
12+
<a href=/integrations/linearb>![LinearB](/downloads/images/linearb-symbol-dark.png#only-light) ![LinearB](/downloads/images/linearb-symbol-white.png#only-dark) LinearB</a>
1313
</div>
1414
</div>
1515

1616
<div class="integrations-card" markdown="1">
1717
<div class="integrations-card-title" markdown="1">
18-
<a href=/integrations/linearb>![LinearB](/downloads/images/linearb-symbol-dark.png#only-light) ![LinearB](/downloads/images/linearb-symbol-white.png#only-dark) LinearB</a>
18+
[:fontawesome-solid-wand-magic-sparkles: LinearB AI](/integrations/LB_AI)
19+
</div>
20+
</div>
21+
22+
<div class="integrations-card" markdown="1">
23+
<div class="integrations-card-title" markdown="1">
24+
[:fontawesome-solid-wand-magic-sparkles: askAI](/integrations/askAI)
1925
</div>
2026
</div>
2127

0 commit comments

Comments
 (0)