Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions docs/automations/integrations/ai-assistance/flag-ai-pr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: Automation - Label AI-Assisted PRs
description: Automatically apply labels to PRs based on AI assistance.
category: [quality, genai, ai, quickstart]
starter_kits: [genai]
---
# Automatically Label AI-Assisted PRs
<!-- --8<-- [start:example]-->
Automatically apply labels to PRs based on whether they were assisted by AI tools. Developers can indicate the specific AI tools or models used, or pre-add an AI-related label to skip the prompt.

=== "Ask Developers About AI Assistance"
### Ask Developers About AI Assistance
Prompt PR authors with a convenient checkbox survey to indicate which AI tools they used for the PR. Developers can pre-add any `🤖 ai-*` label to skip the question. The automation checks for existing labels before posting the prompt.

![Ask About AI Assistance](/automations/integrations/ai-assistance/flag-ai-pr/ask-ai-assistance.png)

!!! info "Configuration Description"
Conditions:

* A PR is created, and no `🤖 ai-*` label is pre-applied.
* The question hasn't been asked before.

Automation Actions:

* Post a comment with a checkbox survey about AI tools used.
* Apply labels based on the checkboxes selected.

!!! example "Ask the PR author about AI assistance."
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/ai-assistance/comment_ai_prompt.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/ai-assistance/comment_ai_prompt.cm){ .md-button }
</span>
</div>


### Track AI Tools
Add labels to the PR according to the tools that the developer checked in the micro-survey above
![Label AI Assistance](/automations/integrations/ai-assistance/flag-ai-pr/label-ai-assistance.png)

!!! info "Configuration Description"
Conditions:

* A PR with selected checkboxes for AI tools used.
* Optional: Details about AI Service and Model specified.

Automation Actions:

* Apply labels for specific AI tools (e.g., `🤖 ai-copilot`, `🤖 ai-cursor`).
* Apply labels for AI services and models if provided.

!!! example "Track AI tools, models and services."
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/ai-assistance/track_ai_models.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/ai-assistance/track_ai_models.cm){ .md-button }
</span>
</div>

=== "Skip the survey for known users"
### Ask Developers About AI Assistance
The automation will not prompt known users for AI assistance. This allows a smoother experience for users who were predefined as AI users, to avoid answering the same questions again.
!!! example "Skip the survey for known users."
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/ai-assistance/comment_ai_prompt_with_known_users.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/ai-assistance/comment_ai_prompt_with_known_users.cm){ .md-button }
</span>
</div>

### Track AI Tools
Add labels to the PR according to the tools that the developer checked in the micro-survey above
![Label AI Assistance](/automations/integrations/ai-assistance/flag-ai-pr/label-ai-assistance.png)

!!! example "Track AI tools, models and services."
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/ai-assistance/track_ai_models.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/ai-assistance/track_ai_models.cm){ .md-button }
</span>
</div>

<!-- --8<-- [end:example]-->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- mode: yaml -*-

manifest:
version: 1.0

triggers:
on:
- pr_created

automations:
comment_ai_assistance_prompt:
# Post a comment for all PRs to prompt the PR author to indicate whether they used AI to assist coding in this PR
# Only do this if there's no existing AI-related label and we haven't asked before
if:
- {{ pr.labels | match(regex=r/🤖 ai-*/) | nope }}
- {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter(attr='content', regex=r/Please mark which AI tools you used/) | nope }}
run:
- action: add-comment@v1
args:
comment: |
Please mark which AI tools you used for this PR by checking the appropriate boxes:

- [ ] GitHub Copilot
- [ ] Cursor
- [ ] Tabnine
- [ ] JetBrains AI Assistant
- [ ] VSCode IntelliCode
- [ ] ChatGPT
- [ ] Claude
- [ ] Gemini
- [ ] Other AI tool
- [ ] No AI tools were used

Tip: If you want to avoid this comment in the future, you can add a label of the format `🤖 ai-*` when creating your PR.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- mode: yaml -*-

manifest:
version: 1.0
triggers:
on:
- pr_created

automations:
comment_ai_assistance_prompt:
# Post a comment for all PRs to prompt the PR author to indicate whether they used AI to assist coding in this PR
# Only do this if there's no existing AI-related label and we haven't asked before
if:
- {{ pr.labels | match(regex=r/🤖 ai-*/) | nope }}
- {{ pr.author | match(list=copilot_contributors) | nope }}
- {{ pr.author | match(list=cursor_contributors) | nope }}
run:
- action: add-comment@v1
args:
comment: |
Please mark which AI tools you used for this PR by checking the appropriate boxes:

- [ ] GitHub Copilot
- [ ] Cursor
- [ ] Tabnine
- [ ] JetBrains AI Assistant
- [ ] VSCode IntelliCode
- [ ] ChatGPT
- [ ] Claude
- [ ] Gemini
- [ ] Other AI tool
- [ ] No AI tools were used

**Tip**: If you want to avoid this comment in the future, add a label of the format `🤖 ai-*` when creating your PR, or ask your admin to add you to the pre-defined lists of known users

label_copilot_known_users:
# For all PRs authored by someone who is specified in the genai_contributors list
if:
- {{ pr.author | match(list=copilot_contributors) | some }}
# Apply a label indicating the user has adopted Copilot
run:
- action: add-label@v1
args:
label: '🤖 ai-copilot'

label_cursor_known_users:
# For all PRs authored by someone who is specified in the genai_contributors list
if:
- {{ pr.author | match(list=cursor_contributors) | some }}
# Apply a label indicating the user has adopted Copilot
run:
- action: add-label@v1
args:
label: '🤖 ai-cursor'

copilot_contributors:
- username1
- username2
- usernameN

cursor_contributors:
- username1
- username2
- usernameN

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# -*- mode: yaml -*-

manifest:
version: 1.0

automations:
label_ai_tools_by_checkbox:
# Apply labels based on the checkboxes selected in the PR comment
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] GitHub Copilot/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-copilot"

label_ai_cursor:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Cursor/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-cursor"

label_ai_tabnine:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Tabnine/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-tabnine"

label_ai_jetbrains:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] JetBrains AI Assistant/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-jetbrains"

label_ai_intellicode:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] VSCode IntelliCode/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-intellicode"

label_ai_chatgpt:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] ChatGPT/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-chatgpt"

label_ai_other:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Other AI tool/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-other"

label_ai_none:
if:
- {{ pr.comments | filter(attr='content', regex=r/\- \[x\] No AI tools were used/) | some }}
run:
- action: add-label@v1
args:
label: "🤖 ai-none"

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-*- mode: yaml -*-
# -*- mode: yaml -*-

manifest:
version: 1.0

on:
- pr_created

automations:
comment_copilot_prompt:
# Post a comment for all PRs to prompt the PR author to indicate whether they used Copilot to assist coding in this PR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ manifest:
version: 1.0

automations:
label_genai:
label_copilot_by_contributors:
# For all PRs authored by someone who is specified in the genai_contributors list
if:
- {{ pr.author | match(list=genai_contributors) | some }}
- {{ pr.author | match(list=genai_contributors) | some }}
# Apply a label indicating the user has adopted Copilot
run:
- action: add-label@v1
args:
label: '🤖 Copilot'
label: '🤖 ai-copilot'

genai_contributors:
- username1
- username2
- etc
- usernameN
6 changes: 6 additions & 0 deletions docs/integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ visible: false
<!-- --8<-- [start:integrations]-->
<div class="integrations-list" markdown="1">

<div class="integrations-card" markdown="1">
<div class="integrations-card-title" markdown="1">
[:material-assistant: AI Assistance](/automations/integrations/ai-assistance/flag-ai-pr)
</div>
</div>

<div class="integrations-card" markdown="1">
<div class="integrations-card-title" markdown="1">
<a href=/integrations/linearb>![LinearB](/downloads/images/linearb-symbol-dark.png#only-light) ![LinearB](/downloads/images/linearb-symbol-white.png#only-dark) LinearB</a>
Expand Down