|
| 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 | +  |
| 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 | +  |
| 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 | +  |
| 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]--> |
0 commit comments