Skip to content

Commit 3775750

Browse files
committed
added configurtion to label by code comment
1 parent d255571 commit 3775750

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

docs/automations/integrations/copilot/flag-copilot-pr/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,26 @@ Automatically apply labels to PRs that are assisted by GitHub Copilot. You can a
9393
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/copilot/label_copilot_by_tag.cm){ .md-button }
9494
</span>
9595
</div>
96+
97+
=== "Label by Copilot code comment"
98+
Use [Code generation instructions](https://code.visualstudio.com/updates/v1_93#code-generation-instructions) to instruct copilot to add a comment at the beginning of the AI generated code. Use gitStream automation to automatically identify PRs with this comment
99+
![Label by Copilot comment](/automations/integrations/copilot/flag-copilot-pr/label-copilot-comment.png)
100+
!!! info "Configuration Description"
101+
Conditions:
102+
103+
* The comment `Generated by Copilot` is added to the code in this PR
104+
105+
Automation Actions:
106+
107+
* Apply a `🤖 Copilot` label to the PR
108+
109+
!!! example "Label Copilot by comment"
110+
```yaml+jinja
111+
--8<-- "docs/downloads/automation-library/integrations/copilot/label_copilot_by_comment.cm"
112+
```
113+
<div class="result" markdown>
114+
<span>
115+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/copilot/label_copilot_by_comment.cm){ .md-button }
116+
</span>
117+
</div>
96118
<!-- --8<-- [end:example]-->
148 KB
Loading
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+
label_copilot_pr:
8+
# Look for the comment 'Generated by Copilot' in the added code
9+
if:
10+
- {{ source.diff.files | matchDiffLines(regex=r/^\+.*Generated by Copilot/, ignoreWhiteSpaces=true) | every }}
11+
run:
12+
- action: add-label@v1
13+
args:
14+
label: '🤖 Copilot'
15+
16+
copilot_comment: "Generated by Copilot"

0 commit comments

Comments
 (0)