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
105 changes: 105 additions & 0 deletions docs/automations/integrations/amazon-q/flag-amazon-q-pr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
title: Automation - Label Amazon Q PRs
description: Automatically apply labels to PRs that are assisted by Amazon Q
category: [quality, genai, amazon_q, quickstart]
starter_kits: [genai]
---
# Automatically Label Amazon Q PRs
<!-- --8<-- [start:example]-->
Automatically apply labels to PRs that are assisted by Amazon Q. You can apply labels based on a known list of Amazon Q users, PR tags, or by prompting the PR author to indicate if they used Amazon Q.

=== "Label by Prompt"
Prompt PR authors to indicate if they used Amazon Q for the PR and automatically label the PR if they did. This requires two separate automation files to handle posting the prompt and labeling accordingly.

![Label Amazon Q by Prompt](/automations/integrations/amazon-q/flag-amazon-q-pr/label-amazon-q-by-prompt.png)

!!! info "Configuration Description"
Conditions:

* A PR is created

Automation Actions:

* Post a comment prompting the author to indicate if Amazon Q assisted the author with writing the code in the PR.

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

!!! info "Configuration Description"
Conditions:

* A PR is updated or merged where the author indicates they used Amazon Q via a prompt.

Automation Actions:

* Apply a `🤖 Amazon Q` label to the PR

!!! example "Label PRs where the user indicated Amazon Q usage"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_prompt.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_prompt.cm){ .md-button }
</span>
</div>
=== "Label by Known Users"
Automatically apply labels to PRs that are created by known users of generative AI coding tools.

![Label by Contributors](/automations/integrations/amazon-q/flag-amazon-q-pr/label-amazon-q-by-contributors.png)
!!! info "Configuration Description"
Conditions:

* The PR author is one of a specified list of contributors

Automation Actions:

* Apply a `🤖 Amazon Q` label to the PR

!!! example "Label by Contributors"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_contributors.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_contributors.cm){ .md-button }
</span>
</div>
=== "Label by Tag"
Look for a specific tag in the PR title, description, comments or commit messages and if found add a label to the PR

![Label Amazon Q by Tag](/automations/integrations/amazon-q/flag-amazon-q-pr/label-amazon-q-by-tag.png)
!!! info "Configuration Description"
Conditions:

* The `#amazon_q#` tag is found in any of the PR title, description, comments or commit messages for commits in the PR
Automation Actions:

* Apply a `🤖 Amazon Q` label to the PR

!!! example "Label Amazon Q by Tag"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_tag.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_tag.cm){ .md-button }
</span>
</div>

## 📈 Track the Business Impact

By labeling PRs assisted by Amazon Q, you can measure:

- Time savings (via Cycle Time, Review Time)
- PR risk (via Refactor Rate, CFR)
- Productivity lift from AI tools

<!-- --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.
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,20 @@
-*- mode: yaml -*-

manifest:
version: 1.0

on:
- pr_created

automations:
comment_amazon_q_prompt:
if:
- true
run:
- action: add-comment@v1
args:
comment: |
Please mark whether you used Amazon Q to assist coding in this PR

- [ ] Amazon Q Assisted
- [ ] Not Amazon Q Assisted
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- mode: yaml -*-

manifest:
version: 1.0

automations:
label_amazon_q_contributors:
if:
- {{ pr.author | match(list=amazon_q_contributors) | some }}
run:
- action: add-label@v1
args:
label: '🤖 Amazon Q'

amazon_q_contributors:
- username1
- username2
- etc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-*- mode: yaml -*-

manifest:
version: 1.0

automations:
label_amazon_q_pr:
if:
- {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter (attr='content', regex=r/\- \[x\] Amazon Q Assisted/) | some}}
run:
- action: add-label@v1
args:
label: '🤖 Amazon Q'
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- mode: yaml -*-

manifest:
version: 1.0

on:
- comment_added
- commit
- pr_created

automations:
label_amazon_q:
if:
- {{ amazon_q_tag.pr_title or amazon_q_tag.pr_desc or amazon_q_tag.pr_comments or amazon_q_tag.commit_messages }}
run:
- action: add-label@v1
args:
label: '🤖 Amazon Q'

amazon_q_tag:
pr_title: {{ pr.title | includes(regex=r/#amazon_q#/) }}
pr_desc: {{pr.description | includes(regex=r/#amazon_q#/) }}
pr_comments: {{ pr.comments | map(attr='content') | match(regex=r/#amazon_q#/) | some }}
commit_messages: {{ branch.commits.messages | match(regex=r/#amazon_q#/) | some }}
6 changes: 6 additions & 0 deletions docs/integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ visible: false
</div>
</div>

<div class="integrations-card" markdown="1">
<div class="integrations-card-title" markdown="1">
[:material-alpha-a-box: Amazon Q](/integrations/amazon-q)
</div>
</div>

<div class="integrations-card" markdown="1">
<div class="integrations-card-title" markdown="1">
[:material-brain: Claude Code](/integrations/claude-code)
Expand Down
15 changes: 15 additions & 0 deletions docs/integrations/amazon-q.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Integrate gitStream with Amazon Q
description: Workflow automations to improve your Amazon Q AI usage.
---
# Integrate gitStream with Amazon Q

## Automatically Label Amazon Q-Assisted PRs

--8<-- "docs/automations/integrations/amazon-q/flag-amazon-q-pr/README.md:example"

## Additional Resources

--8<-- "docs/snippets/general.md"

--8<-- "docs/snippets/automation-footer.md"