Skip to content

Commit d8c40e2

Browse files
authored
Merge pull request #720 from linear-b/add-ai-to-defaults
Add ai to defaults
2 parents a214f37 + 1861619 commit d8c40e2

File tree

12 files changed

+186
-34
lines changed

12 files changed

+186
-34
lines changed

docs/automation-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ automations:
298298
- commit
299299
if:
300300
- {{ not pr.draft }}
301-
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
301+
- {{ pr.author | match(list=['github-actions', '_bot_', 'dependabot', '[bot]']) | nope }}
302302
run:
303303
- action: code-review@v1
304304
args:
@@ -385,7 +385,7 @@ automations:
385385
# skip description for Draft PRs and PRs from bots
386386
if:
387387
- {{ not pr.draft }}
388-
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
388+
- {{ pr.author | match(list=['github-actions', '_bot_', 'dependabot', '[bot]']) | nope }}
389389
run:
390390
- action: describe-changes@v1
391391
args:

docs/automations/integrations/LinearBAI/code-review/README.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,41 @@ Use LinearB's AI with the [`code-review`](/automation-actions/#code-review) acti
2323

2424
* Perform an AI-driven code review and append the review comments to the PR.
2525

26-
!!! example "Configuration Example"
27-
```yaml+jinja
28-
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review.cm"
29-
```
30-
<div class="result" markdown>
31-
<span>
32-
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review.cm){ .md-button }
33-
</span>
34-
</div>
26+
=== "For GitHub"
27+
28+
!!! example "Configuration Example"
29+
```yaml+jinja
30+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review.cm"
31+
```
32+
<div class="result" markdown>
33+
<span>
34+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review.cm){ .md-button }
35+
</span>
36+
</div>
37+
38+
=== "For GitLab"
39+
40+
!!! example "Configuration Example"
41+
```yaml+jinja
42+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review-gl.cm"
43+
```
44+
<div class="result" markdown>
45+
<span>
46+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review-gl.cm){ .md-button }
47+
</span>
48+
</div>
49+
50+
=== "For Bitbucket"
51+
52+
!!! example "Configuration Example"
53+
```yaml+jinja
54+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review-bb.cm"
55+
```
56+
<div class="result" markdown>
57+
<span>
58+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review-bb.cm){ .md-button }
59+
</span>
60+
</div>
3561
<!-- --8<-- [end:example]-->
3662

3763
## Additional Resources

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

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,41 @@ Use the [`describe-changes`](/automation-actions/#describe-changes) automation a
2222

2323
* Append the AI-generated description to the PR description.
2424

25-
!!! example "Configuration Example"
26-
```yaml+jinja
27-
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr.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/describe-pr.cm){ .md-button }
32-
</span>
33-
</div>
25+
=== "For GitHub"
26+
27+
!!! example "Configuration Example"
28+
```yaml+jinja
29+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr.cm"
30+
```
31+
<div class="result" markdown>
32+
<span>
33+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/describe-pr.cm){ .md-button }
34+
</span>
35+
</div>
36+
37+
=== "For GitLab"
38+
39+
!!! example "Configuration Example"
40+
```yaml+jinja
41+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr-gl.cm"
42+
```
43+
<div class="result" markdown>
44+
<span>
45+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/describe-pr-gl.cm){ .md-button }
46+
</span>
47+
</div>
48+
49+
=== "For Bitbucket"
50+
51+
!!! example "Configuration Example"
52+
```yaml+jinja
53+
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr-bb.cm"
54+
```
55+
<div class="result" markdown>
56+
<span>
57+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/describe-pr-bb.cm){ .md-button }
58+
</span>
59+
</div>
3460
<!-- --8<-- [end:example]-->
3561

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

docs/downloads/automation-library/integrations/LinearBAI/code-review.cm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ manifest:
33

44
automations:
55
linearb_ai_review:
6+
# Trigger it only when PR is created or has new commits
67
on:
78
- pr_created
89
- commit
910
if:
1011
- {{ not pr.draft }}
11-
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
12+
- {{ pr.author | match(list=['github-actions', '_bot_', 'dependabot', '[bot]']) | nope }}
1213
run:
1314
- action: code-review@v1
1415
args:
1516
approve_on_LGTM: {{ APPROVE_PR_ON_LGTM }} # optional arg, you can remove it
1617

17-
APPROVE_PR_ON_LGTM: false # you can add conditions for PR approvals. For example - allowing approvals only for specific users
18+
APPROVE_PR_ON_LGTM: false # you can add conditions for PR approvals. For example - allowing approvals only for specific users
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
manifest:
2+
version: 1.0
3+
4+
automations:
5+
linearb_ai_description:
6+
# skip description for Draft PRs and PRs from bots
7+
if:
8+
- {{ pr.author | match(list=['github-actions', '_bot_', 'dependabot', '[bot]']) | nope }}
9+
run:
10+
- action: describe-changes@v1
11+
args:
12+
concat_mode: append
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
manifest:
2+
version: 1.0
3+
4+
automations:
5+
linearb_ai_description:
6+
# skip description for Draft PRs and PRs from bots
7+
if:
8+
- {{ not pr.draft }}
9+
- {{ pr.author | match(list=['github-actions', '_bot_', 'dependabot', '[bot]']) | nope }}
10+
run:
11+
- action: describe-changes@v1
12+
args:
13+
concat_mode: append

docs/downloads/automation-library/integrations/LinearBAI/describe-pr.cm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ manifest:
33

44
automations:
55
linearb_ai_description:
6-
# trigger it only when PR is created or has new commits
6+
# Trigger it only when PR is created or has new commits
7+
# Note: explicit triggers are ignored for GitLab or Bitbucket
78
on:
89
- pr_created
910
- commit
1011
# skip description for Draft PRs and PRs from bots
1112
if:
1213
- {{ not pr.draft }}
13-
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
14+
- {{ pr.author | match(list=['github-actions', '_bot_', 'dependabot', '[bot]']) | nope }}
1415
run:
1516
- action: describe-changes@v1
1617
args:

docs/downloads/gitStream-gl.cm

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ automations:
1010
linearb_ai_review:
1111
if:
1212
- {{ not pr.draft }}
13-
- {{ IS_NOT_A_BOT }}
13+
- {{ not is.bot }}
1414
run:
1515
- action: code-review@v1
16+
args:
17+
approve_on_LGTM: {{ calc.safe_changes }}
1618

1719
# Use LinearB's AI service to add a description to the PR
1820
linearb_ai_description:
1921
if:
2022
- {{ not pr.draft }}
21-
- {{ IS_NOT_A_BOT }}
23+
- {{ not is.bot }}
2224
run:
2325
- action: describe-changes@v1
2426
args:
@@ -64,6 +66,7 @@ automations:
6466

6567
calc:
6668
etr: {{ branch | estimatedReviewTime }}
69+
safe_changes: {{ is.formatting or is.docs or is.tests or is.image }}
6770

6871
has:
6972
jira_ticket_in_title: {{ pr.title | includes(regex=r/\b[A-Za-z]+-\d+\b/) }}
@@ -74,4 +77,9 @@ colors:
7477
yellow: 'fbca04'
7578
green: '0e8a16'
7679

77-
IS_NOT_A_BOT: {{ pr.author | match(list=['_bot_', '[bot]', 'dependabot']) | nope }}
80+
is:
81+
formatting: {{ source.diff.files | isFormattingChange }}
82+
docs: {{ files | allDocs }}
83+
tests: {{ files | allTests }}
84+
image: {{ files | allImages }}
85+
bot: {{ pr.author | match(list=['github-actions', '_bot_', '[bot]', 'dependabot']) | some }}

0 commit comments

Comments
 (0)