Skip to content

Commit 645bb07

Browse files
Merge pull request #708 from azigler/flag-claude-code-pr
📝 docs: automatically labeling Claude Code-assisted PRs
2 parents 9874d31 + 4f332bf commit 645bb07

File tree

10 files changed

+202
-0
lines changed

10 files changed

+202
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
![Label Claude Code by Prompt](/automations/integrations/claude-code/flag-claude-code-pr/label-claude-code-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 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+
![Label by Contributors](/automations/integrations/claude-code/flag-claude-code-pr/label-claude-code-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 `🤖 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+
![Label Claude Code by Tag](/automations/integrations/claude-code/flag-claude-code-pr/label-claude-code-by-tag.png)
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]-->
27.8 KB
Loading
107 KB
Loading
272 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_claude_code_prompt:
11+
if:
12+
- true
13+
run:
14+
- action: add-comment@v1
15+
args:
16+
comment: |
17+
Please mark whether you used Claude Code to assist coding in this PR
18+
19+
- [ ] Claude Code Assisted
20+
- [ ] Not Claude Code 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_claude_code_contributors:
8+
if:
9+
- {{ pr.author | match(list=claude_code_contributors) | some }}
10+
run:
11+
- action: add-label@v1
12+
args:
13+
label: '🤖 Claude Code'
14+
15+
claude_code_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_claude_code_pr:
8+
if:
9+
- {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter (attr='content', regex=r/\- \[x\] Claude Code Assisted/) | some}}
10+
run:
11+
- action: add-label@v1
12+
args:
13+
label: '🤖 Claude Code'
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_claude_code:
13+
if:
14+
- {{ claude_code_tag.pr_title or claude_code_tag.pr_desc or claude_code_tag.pr_comments or claude_code_tag.commit_messages }}
15+
run:
16+
- action: add-label@v1
17+
args:
18+
label: '🤖 Claude Code'
19+
20+
claude_code_tag:
21+
pr_title: {{ pr.title | includes(regex=r/#claude_code#/) }}
22+
pr_desc: {{pr.description | includes(regex=r/#claude_code#/) }}
23+
pr_comments: {{ pr.comments | map(attr='content') | match(regex=r/#claude_code#/) | some }}
24+
commit_messages: {{ branch.commits.messages | match(regex=r/#claude_code#/) | 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-brain: Claude Code](/integrations/claude-code)
83+
</div>
84+
</div>
85+
8086
<div class="integrations-card" markdown="1">
8187
<div class="integrations-card-title" markdown="1">
8288
[:material-sail-boat: Windsurf](/integrations/windsurf)

docs/integrations/claude-code.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 Claude Code
3+
description: Workflow automations to improve your Claude Code AI usage.
4+
---
5+
# Integrate gitStream with Claude Code
6+
7+
## Automatically Label Claude Code-Assisted PRs
8+
9+
--8<-- "docs/automations/integrations/claude-code/flag-claude-code-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)