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
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
title: Automation - Label Claude Code PRs
description: Automatically apply labels to PRs that are assisted by Claude Code
category: [quality, genai, claude_code, quickstart]
starter_kits: [genai]
---
# Automatically Label Claude Code PRs
<!-- --8<-- [start:example]-->
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.

=== "Label by Prompt"
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.

![Label Claude Code by Prompt](/automations/integrations/claude-code/flag-claude-code-pr/label-claude-code-by-prompt.png)

!!! info "Configuration Description"
Conditions:

* A PR is created

Automation Actions:

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

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

!!! info "Configuration Description"
Conditions:

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

Automation Actions:

* Apply a `🤖 Claude Code` label to the PR

!!! example "Label PRs where the user indicated Claude Code usage"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/claude_code/label_claude_code_by_prompt.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/claude_code/label_claude_code_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/claude-code/flag-claude-code-pr/label-claude-code-by-contributors.png)
!!! info "Configuration Description"
Conditions:

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

Automation Actions:

* Apply a `🤖 Claude Code` label to the PR

!!! example "Label by Contributors"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/claude_code/label_claude_code_by_contributors.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/claude_code/label_claude_code_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 Claude Code by Tag](/automations/integrations/claude-code/flag-claude-code-pr/label-claude-code-by-tag.png)
!!! info "Configuration Description"
Conditions:

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

Automation Actions:

* Apply a `🤖 Claude Code` label to the PR

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

## 📈 Track the Business Impact

By labeling PRs assisted by Claude Code, 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_claude_code_prompt:
if:
- true
run:
- action: add-comment@v1
args:
comment: |
Please mark whether you used Claude Code to assist coding in this PR

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

manifest:
version: 1.0

automations:
label_claude_code_contributors:
if:
- {{ pr.author | match(list=claude_code_contributors) | some }}
run:
- action: add-label@v1
args:
label: '🤖 Claude Code'

claude_code_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_claude_code_pr:
if:
- {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter (attr='content', regex=r/\- \[x\] Claude Code Assisted/) | some}}
run:
- action: add-label@v1
args:
label: '🤖 Claude Code'
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_claude_code:
if:
- {{ claude_code_tag.pr_title or claude_code_tag.pr_desc or claude_code_tag.pr_comments or claude_code_tag.commit_messages }}
run:
- action: add-label@v1
args:
label: '🤖 Claude Code'

claude_code_tag:
pr_title: {{ pr.title | includes(regex=r/#claude_code#/) }}
pr_desc: {{pr.description | includes(regex=r/#claude_code#/) }}
pr_comments: {{ pr.comments | map(attr='content') | match(regex=r/#claude_code#/) | some }}
commit_messages: {{ branch.commits.messages | match(regex=r/#claude_code#/) | 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-brain: Claude Code](/integrations/claude-code)
</div>
</div>

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

## Automatically Label Claude Code-Assisted PRs

--8<-- "docs/automations/integrations/claude-code/flag-claude-code-pr/README.md:example"

## Additional Resources

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

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