|
| 1 | +--- |
| 2 | +title: Automation - Label Claude Code PRs |
| 3 | +description: Automatically apply labels to PRs that are assisted by Claude Code |
| 4 | +category: [quality, genai, claude_code, quickstart] |
| 5 | +starter_kits: [genai] |
| 6 | +--- |
| 7 | +# Automatically Label Claude Code PRs |
| 8 | +<!-- --8<-- [start:example]--> |
| 9 | +Automatically apply labels to PRs that are assisted by Claude Code. You can apply labels based on a known list of Claude Code users, PR tags, or by prompting the PR author to indicate if they used Claude Code. |
| 10 | + |
| 11 | +=== "Label by Prompt" |
| 12 | + Prompt PR authors to indicate if they used Claude Code 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 Claude Code assisted the author with writing the code in the PR. |
| 24 | + |
| 25 | + !!! example "Ask the PR author about Claude Code usage." |
| 26 | + ```yaml+jinja |
| 27 | + --8<-- "docs/downloads/automation-library/integrations/claude_code/comment_claude_code_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/claude_code/comment_claude_code_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 Claude Code via a prompt. |
| 39 | + |
| 40 | + Automation Actions: |
| 41 | + |
| 42 | + * Apply a `🤖 Claude Code` label to the PR |
| 43 | + |
| 44 | + !!! example "Label PRs where the user indicated Claude Code usage" |
| 45 | + ```yaml+jinja |
| 46 | + --8<-- "docs/downloads/automation-library/integrations/claude_code/label_claude_code_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/claude_code/label_claude_code_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 `🤖 Claude Code` label to the PR |
| 65 | + |
| 66 | + !!! example "Label by Contributors" |
| 67 | + ```yaml+jinja |
| 68 | + --8<-- "docs/downloads/automation-library/integrations/claude_code/label_claude_code_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/claude_code/label_claude_code_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 `#claude_code#` tag is found in any of the PR title, description, comments or commit messages for commits in the PR |
| 83 | + |
| 84 | + Automation Actions: |
| 85 | + |
| 86 | + * Apply a `🤖 Claude Code` label to the PR |
| 87 | + |
| 88 | + !!! example "Label Claude Code by Tag" |
| 89 | + ```yaml+jinja |
| 90 | + --8<-- "docs/downloads/automation-library/integrations/claude_code/label_claude_code_by_tag.cm" |
| 91 | + ``` |
| 92 | + <div class="result" markdown> |
| 93 | + <span> |
| 94 | + [:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/claude_code/label_claude_code_by_tag.cm){ .md-button } |
| 95 | + </span> |
| 96 | + </div> |
| 97 | + |
| 98 | +## 📈 Track the Business Impact |
| 99 | + |
| 100 | +By labeling PRs assisted by Claude Code, you can measure: |
| 101 | + |
| 102 | +- Time savings (via Cycle Time, Review Time) |
| 103 | +- PR risk (via Refactor Rate, CFR) |
| 104 | +- Productivity lift from AI tools |
| 105 | + |
| 106 | +<!-- --8<-- [end:example]--> |
0 commit comments