Skip to content

Commit 582ee31

Browse files
authored
Merge pull request #592 from linear-b/copilot-by-code-comment
added configurtion to label by code comment
2 parents 61023f0 + fa91985 commit 582ee31

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,31 @@ 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+
99+
!!! warning "Experimental"
100+
Code generation instructions is an experimental setting wich might change in future GitHub Copilot versions.
101+
102+
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
103+
![Label by Copilot comment](/automations/integrations/copilot/flag-copilot-pr/label-copilot-comment.png)
104+
105+
!!! info "Configuration Description"
106+
Conditions:
107+
108+
* The comment `Generated by Copilot` is added to the code in this PR
109+
110+
Automation Actions:
111+
112+
* Apply a `🤖 Copilot` label to the PR
113+
114+
!!! example "Label Copilot by comment"
115+
```yaml+jinja
116+
--8<-- "docs/downloads/automation-library/integrations/copilot/label_copilot_by_comment.cm"
117+
```
118+
<div class="result" markdown>
119+
<span>
120+
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/copilot/label_copilot_by_comment.cm){ .md-button }
121+
</span>
122+
</div>
96123
<!-- --8<-- [end:example]-->
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=copilot_comment, ignoreWhiteSpaces=true) | some }}
11+
run:
12+
- action: add-label@v1
13+
args:
14+
label: '🤖 Copilot'
15+
16+
copilot_comment: "r/^\\+.*Generated by Copilot/"

0 commit comments

Comments
 (0)