Skip to content

Commit 68ff21e

Browse files
authored
Merge pull request #578 from linear-b/Ask-AI-plugin-integrations
Add AI usage examples
2 parents 0e68012 + 853e050 commit 68ff21e

File tree

8 files changed

+169
-9
lines changed

8 files changed

+169
-9
lines changed

docs/automations/automation-library.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ This library of gitStream examples is meant to serve as a starting point for you
4646
### Quality Checks
4747
* [Enforce Semantic PR Titles](standard/enforce-pr-title/README.md) - Enforce PR naming conventions.
4848
* [Enforce Changelog Updates](standard/review-changelog/README.md) - Require changelog updates for PRs that meet specific criteria.
49-
* [Request screenshot](request-screenshot/README.md) - Request a screenshot in the PR description if none exist.
49+
* [Request screenshot](request-screenshot/README.md) - Request a screenshot in the PR description if none exists.
5050
* [Welcome newcomer](welcome-newcomer/README.md) - Post a welcome message when someone makes their first PR to a repo, and provide context to help them know what's next.
5151
* [Remove TODO comments](standard/review-todo-comments/README.md) - Detect TODO comments in PRs and ask the author to remove or fix them.
5252

@@ -56,18 +56,18 @@ These examples help you follow your team's security best practices.
5656
* [Change deprecated components](change-deprecated-components/README.md) - Request changes when a PR includes one or more deprecated components.
5757
* [Enforce copyright headers](standard/enforce-copyright-header/README.md) - Enforce the use of copyright headers when publishing open source code.
5858

59-
## Third-party Integrations
59+
# Integrations
6060

6161
--8<-- "docs/integrations/README.md:integrations"
6262

63-
## Utilities
64-
These examples provide useful components to use in other automations. These aren't intended to be used on their own; instead they act as a reference point for improving other automations.
63+
# Utilities
64+
These examples provide useful components to use in other automations. These aren't intended to be used on their own; instead, they act as a reference point for improving other automations.
6565

6666
* [Colors custom expression](utilities/colors-custom-expression/README.md) - A custom expression that implements all of GitHub's default label colors in a custom expression.
67-
* [CM File Header](utilities/cm-header/README.md) - A header to copy/paste to the top of your CM files to help yourself, and others, understand the purpose of the file.
67+
* [CM File Header](utilities/cm-header/README.md) - A header to copy/paste to the top of your CM files to help yourself and others understand the purpose of the file.
6868

6969

7070
## Contribute Your Idea
7171

72-
!!! tip "Have a great idea for an automation that should be included in this library?"
72+
!!! tip "Do you Have a great idea for an automation that should be included in this library?"
7373
[Submit your configuration](https://github.com/linear-b/gitStream/issues/new?assignees=&labels=new-example&template=new_automation_example.md&title=New+Example%3A+) on GitHub. We'll recognize your contribution publicly (if you want) and might even send you some special swag for your contribution.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Integrate gitStream with AI
3+
description: Use gitStream to integrate with AI services for Review, describe and add tests.
4+
---
5+
# Integrate gitStream with AI
6+
7+
--8<-- "docs/automations/integrations/AI/askAI/README.md:examples"
8+
9+
## Additional Resources
10+
11+
--8<-- "docs/snippets/general.md"
12+
13+
--8<-- "docs/snippets/automation-footer.md"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: Integrate gitStream with AI
3+
description: Use gitStream to integrate with AI services for Review, describe and add tests.
4+
category: [quality, genai, copilot, tests, efficiency]
5+
---
6+
# Integrate gitStream with AI
7+
8+
<!-- --8<-- [start:examples]-->
9+
## Use askAI plugin to interact with AI chatbots
10+
11+
!!! warning "Required gitStream Plugins"
12+
This example requires you to install the [`askAI`](/filter-function-plugins/#askai) plugin.
13+
14+
[Learn more about gitStream plugins](/plugins/).
15+
16+
17+
=== "Code Review"
18+
!!! info "Configuration Description"
19+
20+
Conditions (all must be true):
21+
22+
* A PR is created or new code has been committed to the PR.
23+
* The PR has a label "AskAI CR"
24+
25+
Automation Actions:
26+
27+
* Add a comment with the code review generated by an AI model
28+
29+
!!! example "Configuration Example"
30+
```yaml+jinja
31+
--8<-- "docs/downloads/automation-library/integrations/askAI/askAI_CR.cm"
32+
```
33+
<div class="result" markdown>
34+
<span>
35+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/askAI/askAI-CR.cm){ .md-button }
36+
</span>
37+
</div>
38+
=== "Describe PR"
39+
!!! info "Configuration Description"
40+
41+
Conditions (all must be true):
42+
43+
* A PR is created or new code has been committed to the PR.
44+
* The PR has a label "AskAI Describe"
45+
46+
Automation Actions:
47+
48+
* Add a comment with the code review generated by an AI model
49+
50+
!!! example "Configuration Example"
51+
```yaml+jinja
52+
--8<-- "docs/downloads/automation-library/integrations/askAI/askAI_describe.cm"
53+
```
54+
<div class="result" markdown>
55+
<span>
56+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/askAI/askAI-Describe.cm){ .md-button }
57+
</span>
58+
</div>
59+
=== "QA tests"
60+
!!! info "Configuration Description"
61+
62+
Conditions (all must be true):
63+
64+
* A PR is created or new code has been committed to the PR.
65+
* The PR has a label "AskAI QA"
66+
67+
Automation Actions:
68+
69+
* Add a comment with the code review generated by an AI model
70+
71+
!!! example "Configuration Example"
72+
```yaml+jinja
73+
--8<-- "docs/downloads/automation-library/integrations/askAI/askAI_QA.cm"
74+
```
75+
<div class="result" markdown>
76+
<span>
77+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/askAI/askAI-QA.cm){ .md-button }
78+
</span>
79+
</div>
80+
81+
82+
83+
<!-- --8<-- [end:examples]-->
84+
## Additional Resources
85+
86+
--8<-- "docs/snippets/general.md"
87+
88+
--8<-- "docs/snippets/automation-footer.md"
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+
triggers:
5+
on:
6+
- commit
7+
- pr_created
8+
9+
automations:
10+
ask_ai_describe:
11+
if:
12+
- {{ pr.labels | match(term="askai cr") | some }}
13+
run:
14+
- action: add-comment@v1
15+
args:
16+
comment: |
17+
# ✨ gitStream Review ✨
18+
{{ source | askAI("Based on the given context, can you write a few bullet points about how I can improve my code? Please relate only to code diff, if it exists.", env.OPEN_AI_TOKEN) | encode }}
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+
triggers:
5+
on:
6+
- commit
7+
- pr_created
8+
9+
automations:
10+
ask_ai_describe:
11+
if:
12+
- {{ pr.labels | match(term="askai qa") | some }}
13+
run:
14+
- action: add-comment@v1
15+
args:
16+
comment: |
17+
# ✨ gitStream QA ✨
18+
{{ source | askAI("Based on the given context, search for new functions without tests and suggest the tests to add. If all functions are covered completely, return 'no tests to suggest.'", env.OPEN_AI_TOKEN) | encode }}
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+
triggers:
5+
on:
6+
- commit
7+
- pr_created
8+
9+
automations:
10+
ask_ai_describe:
11+
if:
12+
- {{ pr.labels | match(term="askai describe") | some }}
13+
run:
14+
- action: add-comment@v1
15+
args:
16+
comment: |
17+
# ✨ gitStream Describe PR ✨
18+
{{ source | askAI("based on the given context, describe in plain english the changes introduced in this PR.", env.OPEN_AI_TOKEN) | encode }}

docs/filter-function-plugins.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ description: Implement custom gitStream filter functions with JavaScript.
66

77
JavaScript plugins that enable custom filter functions for gitStream. To learn how to use these examples, read our [guide on how to use gitStream plugins](/plugins).
88

9-
askAI-plugin
109
--8<-- "plugins/filters/askAI/README.md"
1110

1211
--8<-- "plugins/filters/checklist/README.md"

docs/integrations/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ visible: false
66
# gitStream Integrations
77
<!-- --8<-- [start:integrations]-->
88
<div class="integrations-list" markdown="1">
9+
10+
<div class="integrations-card" markdown="1">
11+
<div class="integrations-card-title" markdown="1">
12+
[AI](/automations/integrations/AI)
13+
</div>
14+
</div>
915

1016
<div class="integrations-card" markdown="1">
1117
<div class="integrations-card-title" markdown="1">
@@ -19,13 +25,13 @@ visible: false
1925

2026
<div class="integrations-card" markdown="1">
2127
<div class="integrations-card-title" markdown="1">
22-
[::simple-githubactions:: GitHub Actions](/integrations/github-actions)
28+
[:simple-githubactions: GitHub Actions](/integrations/github-actions)
2329
</div>
2430
</div>
2531

2632
<div class="integrations-card" markdown="1">
2733
<div class="integrations-card-title" markdown="1">
28-
[::octicons-copilot-16:: GitHub Copilot](/integrations/github-copilot)
34+
[:octicons-copilot-16: GitHub Copilot](/integrations/github-copilot)
2935
</div>
3036
</div>
3137

0 commit comments

Comments
 (0)