From 3087c20d86db8c3ccee64c279fcb26e3628b23b2 Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:41:16 +0300 Subject: [PATCH 1/9] Update filter-function-plugins.md --- docs/filter-function-plugins.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/filter-function-plugins.md b/docs/filter-function-plugins.md index 8e652447..9c11beae 100644 --- a/docs/filter-function-plugins.md +++ b/docs/filter-function-plugins.md @@ -6,7 +6,6 @@ description: Implement custom gitStream filter functions with JavaScript. 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). - askAI-plugin --8<-- "plugins/filters/askAI/README.md" --8<-- "plugins/filters/checklist/README.md" From 1d6508466836be2c27a9e00028b10b118234f86c Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:45:28 +0300 Subject: [PATCH 2/9] Update automation-library.md --- docs/automations/automation-library.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/automations/automation-library.md b/docs/automations/automation-library.md index e2cbf052..46acdb26 100644 --- a/docs/automations/automation-library.md +++ b/docs/automations/automation-library.md @@ -56,18 +56,18 @@ These examples help you follow your team's security best practices. * [Change deprecated components](change-deprecated-components/README.md) - Request changes when a PR includes one or more deprecated components. * [Enforce copyright headers](standard/enforce-copyright-header/README.md) - Enforce the use of copyright headers when publishing open source code. -## Third-party Integrations +# Integrations --8<-- "docs/integrations/README.md:integrations" -## Utilities -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. +# Utilities +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. * [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. -* [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. +* [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. ## Contribute Your Idea -!!! tip "Have a great idea for an automation that should be included in this library?" +!!! tip "Do you Have a great idea for an automation that should be included in this library?" [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. From 0116aed2b8da7543da6553f8f18f8800db96c716 Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:47:57 +0300 Subject: [PATCH 3/9] Update automation-library.md --- docs/automations/automation-library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/automations/automation-library.md b/docs/automations/automation-library.md index 46acdb26..a4b7d0bb 100644 --- a/docs/automations/automation-library.md +++ b/docs/automations/automation-library.md @@ -46,7 +46,7 @@ This library of gitStream examples is meant to serve as a starting point for you ### Quality Checks * [Enforce Semantic PR Titles](standard/enforce-pr-title/README.md) - Enforce PR naming conventions. * [Enforce Changelog Updates](standard/review-changelog/README.md) - Require changelog updates for PRs that meet specific criteria. -* [Request screenshot](request-screenshot/README.md) - Request a screenshot in the PR description if none exist. +* [Request screenshot](request-screenshot/README.md) - Request a screenshot in the PR description if none exists. * [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. * [Remove TODO comments](standard/review-todo-comments/README.md) - Detect TODO comments in PRs and ask the author to remove or fix them. From dfecaf51442158d27f5ef30094e6bad80d51a32f Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Mon, 2 Sep 2024 18:07:41 +0300 Subject: [PATCH 4/9] integrations page --- docs/integrations/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/integrations/README.md b/docs/integrations/README.md index e3696796..3f775a8e 100644 --- a/docs/integrations/README.md +++ b/docs/integrations/README.md @@ -6,6 +6,12 @@ visible: false # gitStream Integrations
+ +
+
+[:material-AutoAwesome: AI](/integrations/AI) +
+
From 10edf7a790aea078a9b6499142f028630a82bef4 Mon Sep 17 00:00:00 2001 From: PavelLinearB Date: Mon, 2 Sep 2024 20:49:50 +0300 Subject: [PATCH 5/9] added use cases --- docs/automations/integrations/AI/README.md | 13 +++ .../integrations/AI/askAI/README.md | 88 +++++++++++++++++++ .../integrations/askAI/askAI_CR.cm | 17 ++++ .../integrations/askAI/askAI_QA.cm | 17 ++++ .../integrations/askAI/askAI_describe.cm | 17 ++++ docs/integrations/README.md | 6 +- 6 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 docs/automations/integrations/AI/README.md create mode 100644 docs/automations/integrations/AI/askAI/README.md create mode 100644 docs/downloads/automation-library/integrations/askAI/askAI_CR.cm create mode 100644 docs/downloads/automation-library/integrations/askAI/askAI_QA.cm create mode 100644 docs/downloads/automation-library/integrations/askAI/askAI_describe.cm diff --git a/docs/automations/integrations/AI/README.md b/docs/automations/integrations/AI/README.md new file mode 100644 index 00000000..e5aa5f39 --- /dev/null +++ b/docs/automations/integrations/AI/README.md @@ -0,0 +1,13 @@ +--- +title: Integrate gitStream with AI +description: Use gitStream to integrate with AI services for Review, describe and add tests. +--- +# Integrate gitStream with AI + +--8<-- "docs/automations/integrations/AI/askAI/README.md:examples" + +## Additional Resources + +--8<-- "docs/snippets/general.md" + +--8<-- "docs/snippets/automation-footer.md" \ No newline at end of file diff --git a/docs/automations/integrations/AI/askAI/README.md b/docs/automations/integrations/AI/askAI/README.md new file mode 100644 index 00000000..bfdc2732 --- /dev/null +++ b/docs/automations/integrations/AI/askAI/README.md @@ -0,0 +1,88 @@ +--- +title: Integrate gitStream with AI +description: Use gitStream to integrate with AI services for Review, describe and add tests. +category: [quality, genai, copilot, tests, efficiency] +--- +# Integrate gitStream with AI + + +## Use askAI plugin to interact with AI chatbots + +!!! warning "Required gitStream Plugins" + This example requires you to install the [`askAI`](/filter-function-plugins/#askai) plugin. + + [Learn more about gitStream plugins](/plugins/). + + +=== "Code Review" + !!! info "Configuration Description" + + Conditions (all must be true): + + * A PR is created or new code has been committed to the PR. + * The PR has a label "AskAI CR" + + Automation Actions: + + * Add a comment with the code review generated by an AI model + + !!! example "Configuration Example" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/askAI/askAI_CR.cm" + ``` +
+ + [:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/askAI/askAI-CR.cm){ .md-button } + +
+=== "Describe PR" + !!! info "Configuration Description" + + Conditions (all must be true): + + * A PR is created or new code has been committed to the PR. + * The PR has a label "AskAI Describe" + + Automation Actions: + + * Add a comment with the code review generated by an AI model + + !!! example "Configuration Example" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/askAI/askAI_describe.cm" + ``` +
+ + [:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/askAI/askAI-Describe.cm){ .md-button } + +
+=== "QA tests" + !!! info "Configuration Description" + + Conditions (all must be true): + + * A PR is created or new code has been committed to the PR. + * The PR has a label "AskAI QA" + + Automation Actions: + + * Add a comment with the code review generated by an AI model + + !!! example "Configuration Example" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/askAI/askAI_QA.cm" + ``` +
+ + [:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/askAI/askAI-QA.cm){ .md-button } + +
+ + + + +## Additional Resources + +--8<-- "docs/snippets/general.md" + +--8<-- "docs/snippets/automation-footer.md" \ No newline at end of file diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm b/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm new file mode 100644 index 00000000..84349926 --- /dev/null +++ b/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm @@ -0,0 +1,17 @@ +manifest: + version: 1.0 + +triggers: + on: + - commit + - pr_created + +automations: + ask_ai_describe: + if: + - {{ pr.labels | match(term="AskAI CR") | some }} + run: + - action: add-comment@v1 + args: + comment: | + {{ 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) | prependTitle("gitStream Review") | encode }} \ No newline at end of file diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm b/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm new file mode 100644 index 00000000..e19e54e0 --- /dev/null +++ b/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm @@ -0,0 +1,17 @@ +manifest: + version: 1.0 + +triggers: + on: + - commit + - pr_created + +automations: + ask_ai_describe: + if: + - {{ pr.labels | match(term="askAI qa") | some }} + run: + - action: add-comment@v1 + args: + comment: | + {{ 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 }} \ No newline at end of file diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm b/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm new file mode 100644 index 00000000..561ed3f5 --- /dev/null +++ b/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm @@ -0,0 +1,17 @@ +manifest: + version: 1.0 + +triggers: + on: + - commit + - pr_created + +automations: + ask_ai_describe: + if: + - {{ pr.labels | match(term="askAI qa") | some }} + run: + - action: add-comment@v1 + args: + comment: | + {{ source | askAI("based on the given context, describe in plain english the changes introduced in this PR.", env.OPEN_AI_TOKEN) | prependTitle("gitStream Describe PR") | encode }} \ No newline at end of file diff --git a/docs/integrations/README.md b/docs/integrations/README.md index 3f775a8e..15679b74 100644 --- a/docs/integrations/README.md +++ b/docs/integrations/README.md @@ -9,7 +9,7 @@ visible: false
-[:material-AutoAwesome: AI](/integrations/AI) +[AI](/automations/integrations/AI)
@@ -25,13 +25,13 @@ visible: false
-[::simple-githubactions:: GitHub Actions](/integrations/github-actions) +[:simple-githubactions: GitHub Actions](/integrations/github-actions)
-[::octicons-copilot-16:: GitHub Copilot](/integrations/github-copilot) +[:octicons-copilot-16: GitHub Copilot](/integrations/github-copilot)
From edd15fbe6f28c6c07c4e516bfa104b5e7b765a69 Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:28:36 +0300 Subject: [PATCH 6/9] Update askAI_CR.cm --- .../automation-library/integrations/askAI/askAI_CR.cm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm b/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm index 84349926..91adace4 100644 --- a/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm +++ b/docs/downloads/automation-library/integrations/askAI/askAI_CR.cm @@ -9,9 +9,10 @@ triggers: automations: ask_ai_describe: if: - - {{ pr.labels | match(term="AskAI CR") | some }} + - {{ pr.labels | match(term="askai cr") | some }} run: - action: add-comment@v1 args: comment: | - {{ 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) | prependTitle("gitStream Review") | encode }} \ No newline at end of file + # ✨ gitStream Review ✨ + {{ 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 }} From dd995117ac8c995c8c3b404fc62f3ba25c77df53 Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:31:48 +0300 Subject: [PATCH 7/9] Update askAI_QA.cm --- .../automation-library/integrations/askAI/askAI_QA.cm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm b/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm index e19e54e0..39f056de 100644 --- a/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm +++ b/docs/downloads/automation-library/integrations/askAI/askAI_QA.cm @@ -9,9 +9,10 @@ triggers: automations: ask_ai_describe: if: - - {{ pr.labels | match(term="askAI qa") | some }} + - {{ pr.labels | match(term="askai qa") | some }} run: - action: add-comment@v1 args: comment: | - {{ 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 }} \ No newline at end of file + # ✨ gitStream QA ✨ + {{ 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 }} From c35e17ba4a04ca4b3ec3ac0fadae16e65265006e Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:32:31 +0300 Subject: [PATCH 8/9] Update askAI_describe.cm --- .../automation-library/integrations/askAI/askAI_describe.cm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm b/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm index 561ed3f5..a6ebd6eb 100644 --- a/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm +++ b/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm @@ -14,4 +14,5 @@ automations: - action: add-comment@v1 args: comment: | - {{ source | askAI("based on the given context, describe in plain english the changes introduced in this PR.", env.OPEN_AI_TOKEN) | prependTitle("gitStream Describe PR") | encode }} \ No newline at end of file + # ✨ gitStream Describe PR ✨ + {{ source | askAI("based on the given context, describe in plain english the changes introduced in this PR.", env.OPEN_AI_TOKEN) | encode }} From 853e050f91d087202c145618730876b09f7b3e7c Mon Sep 17 00:00:00 2001 From: Pavel Vaks <129676672+PavelLinearB@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:33:38 +0300 Subject: [PATCH 9/9] Update askAI_describe.cm --- .../automation-library/integrations/askAI/askAI_describe.cm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm b/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm index a6ebd6eb..d3a8e256 100644 --- a/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm +++ b/docs/downloads/automation-library/integrations/askAI/askAI_describe.cm @@ -9,7 +9,7 @@ triggers: automations: ask_ai_describe: if: - - {{ pr.labels | match(term="askAI qa") | some }} + - {{ pr.labels | match(term="askai describe") | some }} run: - action: add-comment@v1 args: