Skip to content

Commit fbb6830

Browse files
committed
📝 docs: automatically labeling Amazon Q-assisted PRs
1 parent 645bb07 commit fbb6830

File tree

10 files changed

+201
-0
lines changed

10 files changed

+201
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
title: Automation - Label Amazon Q PRs
3+
description: Automatically apply labels to PRs that are assisted by Amazon Q
4+
category: [quality, genai, amazon_q, quickstart]
5+
starter_kits: [genai]
6+
---
7+
# Automatically Label Amazon Q PRs
8+
<!-- --8<-- [start:example]-->
9+
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.
10+
11+
=== "Label by Prompt"
12+
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.
13+
14+
![Label Amazon Q by Prompt](/automations/integrations/amazon-q/flag-amazon-q-pr/label-amazon-q-by-prompt.png)
15+
16+
!!! info "Configuration Description"
17+
Conditions:
18+
19+
* A PR is created
20+
21+
Automation Actions:
22+
23+
* Post a comment prompting the author to indicate if Amazon Q assisted the author with writing the code in the PR.
24+
25+
!!! example "Ask the PR author about Amazon Q usage"
26+
```yaml+jinja
27+
--8<-- "docs/downloads/automation-library/integrations/amazon_q/comment_amazon_q_prompt.cm"
28+
```
29+
<div class="result" markdown>
30+
<span>
31+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/comment_amazon_q_prompt.cm){ .md-button }
32+
</span>
33+
</div>
34+
35+
!!! info "Configuration Description"
36+
Conditions:
37+
38+
* A PR is updated or merged where the author indicates they used Amazon Q via a prompt.
39+
40+
Automation Actions:
41+
42+
* Apply a `🤖 Amazon Q` label to the PR
43+
44+
!!! example "Label PRs where the user indicated Amazon Q usage"
45+
```yaml+jinja
46+
--8<-- "docs/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_prompt.cm"
47+
```
48+
<div class="result" markdown>
49+
<span>
50+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_prompt.cm){ .md-button }
51+
</span>
52+
</div>
53+
=== "Label by Known Users"
54+
Automatically apply labels to PRs that are created by known users of generative AI coding tools.
55+
56+
![Label by Contributors](/automations/integrations/amazon-q/flag-amazon-q-pr/label-amazon-q-by-contributors.png)
57+
!!! info "Configuration Description"
58+
Conditions:
59+
60+
* The PR author is one of a specified list of contributors
61+
62+
Automation Actions:
63+
64+
* Apply a `🤖 Amazon Q` label to the PR
65+
66+
!!! example "Label by Contributors"
67+
```yaml+jinja
68+
--8<-- "docs/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_contributors.cm"
69+
```
70+
<div class="result" markdown>
71+
<span>
72+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_contributors.cm){ .md-button }
73+
</span>
74+
</div>
75+
=== "Label by Tag"
76+
Look for a specific tag in the PR title, description, comments or commit messages and if found add a label to the PR
77+
78+
![Label Amazon Q by Tag](/automations/integrations/amazon-q/flag-amazon-q-pr/label-amazon-q-by-tag.png)
79+
!!! info "Configuration Description"
80+
Conditions:
81+
82+
* The `#amazon_q#` tag is found in any of the PR title, description, comments or commit messages for commits in the PR
83+
Automation Actions:
84+
85+
* Apply a `🤖 Amazon Q` label to the PR
86+
87+
!!! example "Label Amazon Q by Tag"
88+
```yaml+jinja
89+
--8<-- "docs/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_tag.cm"
90+
```
91+
<div class="result" markdown>
92+
<span>
93+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/amazon_q/label_amazon_q_by_tag.cm){ .md-button }
94+
</span>
95+
</div>
96+
97+
## 📈 Track the Business Impact
98+
99+
By labeling PRs assisted by Amazon Q, you can measure:
100+
101+
- Time savings (via Cycle Time, Review Time)
102+
- PR risk (via Refactor Rate, CFR)
103+
- Productivity lift from AI tools
104+
105+
<!-- --8<-- [end:example]-->
26.7 KB
Loading
103 KB
Loading
214 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
on:
7+
- pr_created
8+
9+
automations:
10+
comment_amazon_q_prompt:
11+
if:
12+
- true
13+
run:
14+
- action: add-comment@v1
15+
args:
16+
comment: |
17+
Please mark whether you used Amazon Q to assist coding in this PR
18+
19+
- [ ] Amazon Q Assisted
20+
- [ ] Not Amazon Q Assisted
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
automations:
7+
label_amazon_q_contributors:
8+
if:
9+
- {{ pr.author | match(list=amazon_q_contributors) | some }}
10+
run:
11+
- action: add-label@v1
12+
args:
13+
label: '🤖 Amazon Q'
14+
15+
amazon_q_contributors:
16+
- username1
17+
- username2
18+
- etc
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
automations:
7+
label_amazon_q_pr:
8+
if:
9+
- {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter (attr='content', regex=r/\- \[x\] Amazon Q Assisted/) | some}}
10+
run:
11+
- action: add-label@v1
12+
args:
13+
label: '🤖 Amazon Q'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
on:
7+
- comment_added
8+
- commit
9+
- pr_created
10+
11+
automations:
12+
label_amazon_q:
13+
if:
14+
- {{ amazon_q_tag.pr_title or amazon_q_tag.pr_desc or amazon_q_tag.pr_comments or amazon_q_tag.commit_messages }}
15+
run:
16+
- action: add-label@v1
17+
args:
18+
label: '🤖 Amazon Q'
19+
20+
amazon_q_tag:
21+
pr_title: {{ pr.title | includes(regex=r/#amazon_q#/) }}
22+
pr_desc: {{pr.description | includes(regex=r/#amazon_q#/) }}
23+
pr_comments: {{ pr.comments | map(attr='content') | match(regex=r/#amazon_q#/) | some }}
24+
commit_messages: {{ branch.commits.messages | match(regex=r/#amazon_q#/) | some }}

docs/integrations/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ visible: false
7777
</div>
7878
</div>
7979

80+
<div class="integrations-card" markdown="1">
81+
<div class="integrations-card-title" markdown="1">
82+
[:material-alpha-a-box: Amazon Q](/integrations/amazon-q)
83+
</div>
84+
</div>
85+
8086
<div class="integrations-card" markdown="1">
8187
<div class="integrations-card-title" markdown="1">
8288
[:material-brain: Claude Code](/integrations/claude-code)

docs/integrations/amazon-q.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Integrate gitStream with Amazon Q
3+
description: Workflow automations to improve your Amazon Q AI usage.
4+
---
5+
# Integrate gitStream with Amazon Q
6+
7+
## Automatically Label Amazon Q-Assisted PRs
8+
9+
--8<-- "docs/automations/integrations/amazon-q/flag-amazon-q-pr/README.md:example"
10+
11+
## Additional Resources
12+
13+
--8<-- "docs/snippets/general.md"
14+
15+
--8<-- "docs/snippets/automation-footer.md"

0 commit comments

Comments
 (0)