Skip to content

Commit b0532e1

Browse files
Merge pull request #690 from azigler/flag-cursor-pr
📝 docs: automatically labeling Cursor-assisted PRs
2 parents 5c79354 + 1852fce commit b0532e1

File tree

11 files changed

+223
-5
lines changed

11 files changed

+223
-5
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Automation - Label Cursor PRs
3+
description: Automatically apply labels to PRs that are assisted by Cursor
4+
category: [quality, genai, cursor, quickstart]
5+
---
6+
7+
# Automatically Label Cursor PRs
8+
<!-- --8<-- [start:example]-->
9+
Automatically apply labels to Pull Requests that are assisted by Cursor AI. This automation helps track the impact and usage of Cursor's AI capabilities across your development workflow. You can apply labels based on:
10+
11+
- A known list of Cursor users
12+
- AI-generated code comments
13+
- PR tags
14+
- Inline prompt responses
15+
16+
=== "Label by Prompt"
17+
Prompt PR authors to indicate if they used Cursor 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.
18+
19+
![Label Cursor by Prompt](/automations/integrations/cursor/flag-cursor-pr/label-cursor-by-prompt.png)
20+
21+
!!! info "Configuration Description"
22+
Conditions:
23+
24+
* A PR is created
25+
26+
Automation Actions:
27+
28+
* Post a comment prompting the author to indicate if Cursor assisted the author with writing the code in the PR.
29+
30+
!!! example "Ask the PR author about Cursor usage."
31+
```yaml+jinja
32+
--8<-- "docs/downloads/automation-library/integrations/cursor/comment_cursor_prompt.cm"
33+
```
34+
<div class="result" markdown>
35+
<span>
36+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/cursor/comment_cursor_prompt.cm){ .md-button }
37+
</span>
38+
</div>
39+
40+
!!! info "Configuration Description"
41+
Conditions:
42+
43+
* A PR is updated or merged where the author indicates they used Cursor via a prompt.
44+
45+
Automation Actions:
46+
47+
* Apply a `🤖 Cursor` label to the PR
48+
49+
!!! example "Label PRs where the user indicated Cursor usage"
50+
```yaml+jinja
51+
--8<-- "docs/downloads/automation-library/integrations/cursor/label_cursor_by_prompt.cm"
52+
```
53+
<div class="result" markdown>
54+
<span>
55+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/cursor/label_cursor_by_prompt.cm){ .md-button }
56+
</span>
57+
</div>
58+
59+
=== "Label by Known Users"
60+
Automatically apply labels to PRs that are created by known users of generative AI coding tools.
61+
62+
![Label by Contributors](/automations/integrations/cursor/flag-cursor-pr/label-cursor-by-contributors.png)
63+
!!! info "Configuration Description"
64+
Conditions:
65+
66+
* The PR author is one of a specified list of contributors
67+
68+
Automation Actions:
69+
70+
* Apply a `🤖 Cursor` label to the PR
71+
72+
!!! example "Label by Contributors"
73+
```yaml+jinja
74+
--8<-- "docs/downloads/automation-library/integrations/cursor/label_cursor_by_contributors.cm"
75+
```
76+
<div class="result" markdown>
77+
<span>
78+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/cursor/label_cursor_by_contributors.cm){ .md-button }
79+
</span>
80+
</div>
81+
82+
=== "Label by Tag"
83+
Look for a specific tag in the PR title, description, comments or commit messages and if found add a label to the PR
84+
85+
![Label Cursor by Tag](/automations/integrations/cursor/flag-cursor-pr/label-cursor-by-tag.png)
86+
!!! info "Configuration Description"
87+
Conditions:
88+
89+
* The `#cursor#` tag is found in any of the PR title, description, comments or commit messages for commits in the PR
90+
91+
Automation Actions:
92+
93+
* Apply a `🤖 Cursor` label to the PR
94+
95+
!!! example "Label Cursor by Tag"
96+
```yaml+jinja
97+
--8<-- "docs/downloads/automation-library/integrations/cursor/label_cursor_by_tag.cm"
98+
```
99+
<div class="result" markdown>
100+
<span>
101+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/cursor/label_cursor_by_tag.cm){ .md-button }
102+
</span>
103+
</div>
104+
<!-- --8<-- [end:example]-->
29.2 KB
Loading
253 KB
Loading
251 KB
Loading
3.06 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
on:
7+
- pr_created
8+
9+
automations:
10+
comment_cursor_prompt:
11+
# Post a comment for all PRs to prompt the PR author to indicate whether they used Cursor to assist coding in this PR
12+
if:
13+
- true
14+
run:
15+
- action: add-comment@v1
16+
args:
17+
comment: |
18+
Please mark whether you used Cursor to assist coding in this PR
19+
20+
- [ ] Cursor Assisted
21+
- [ ] Not Cursor Assisted
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+
automations:
7+
label_cursor_contributors:
8+
# For all PRs authored by someone who is specified in the cursor_contributors list
9+
if:
10+
- {{ pr.author | match(list=cursor_contributors) | some }}
11+
# Apply a label indicating the user has adopted Cursor
12+
run:
13+
- action: add-label@v1
14+
args:
15+
label: '🤖 Cursor'
16+
17+
cursor_contributors:
18+
- username1
19+
- username2
20+
- etc
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
automations:
7+
# You should use this automation in conjunction with comment_cursor_prompt.cm
8+
label_cursor_pr:
9+
# If the PR author has indicated that they used Cursor to assist coding in this PR,
10+
# apply a label indicating the PR was supported by Cursor
11+
if:
12+
- {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter (attr='content', regex=r/\- \[x\] Cursor Assisted/) | some}}
13+
run:
14+
- action: add-label@v1
15+
args:
16+
label: '🤖 Cursor'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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_cursor:
13+
# Detect PRs that contain the text '#cursor#' in the title, description, comments, or commit messages
14+
if:
15+
- {{ cursor_tag.pr_title or cursor_tag.pr_desc or cursor_tag.pr_comments or cursor_tag.commit_messages }}
16+
# Apply a label indicating the user has adopted Cursor
17+
run:
18+
- action: add-label@v1
19+
args:
20+
label: '🤖 Cursor'
21+
22+
cursor_tag:
23+
pr_title: {{ pr.title | includes(regex=r/#cursor#/) }}
24+
pr_desc: {{pr.description | includes(regex=r/#cursor#/) }}
25+
pr_comments: {{ pr.comments | map(attr='content') | match(regex=r/#cursor#/) | some }}
26+
commit_messages: {{ branch.commits.messages | match(regex=r/#cursor#/) | some }}

docs/integrations/README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,37 @@ visible: false
4343

4444
<div class="integrations-card" markdown="1">
4545
<div class="integrations-card-title" markdown="1">
46-
[:octicons-copilot-16: GitHub Copilot](/integrations/github-copilot)
46+
[:material-label: PR Labels](/automations/standard/label-management)
4747
</div>
4848
</div>
4949

5050
<div class="integrations-card" markdown="1">
5151
<div class="integrations-card-title" markdown="1">
52-
[:material-label: PR Labels](/automations/standard/label-management)
52+
[:material-git: Branch Management](/automations/standard/branch-management)
5353
</div>
5454
</div>
5555

5656
<div class="integrations-card" markdown="1">
5757
<div class="integrations-card-title" markdown="1">
58-
[:material-git: Branch Management](/automations/standard/branch-management)
58+
[:simple-codereview: PR Reviews](/automations/standard/review-assignment)
5959
</div>
6060
</div>
6161

62+
</div>
63+
64+
## AI Tools
65+
66+
<div class="integrations-list" markdown="1">
67+
6268
<div class="integrations-card" markdown="1">
6369
<div class="integrations-card-title" markdown="1">
64-
[:simple-codereview: PR Reviews](/automations/standard/review-assignment)
70+
[:octicons-copilot-16: GitHub Copilot](/integrations/github-copilot)
71+
</div>
72+
</div>
73+
74+
<div class="integrations-card" markdown="1">
75+
<div class="integrations-card-title" markdown="1">
76+
[:material-cube-outline: Cursor](/integrations/cursor)
6577
</div>
6678
</div>
6779

@@ -164,6 +176,7 @@ visible: false
164176
</div>
165177

166178
## Feature Flags
179+
167180
<div class="integrations-list" markdown="1">
168181

169182
<div class="integrations-card" markdown="1">
@@ -198,8 +211,8 @@ visible: false
198211

199212
</div>
200213

201-
202214
## Languages
215+
203216
<div class="integrations-list" markdown="1">
204217

205218
<div class="integrations-card" markdown="1">
@@ -301,4 +314,7 @@ visible: false
301314
<!-- --8<-- [end:integrations]-->
302315

303316
## Additional Resources
317+
318+
--8<-- "docs/snippets/general.md"
319+
304320
--8<-- "docs/snippets/general.md"

0 commit comments

Comments
 (0)