-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #381 from linear-b/language-labels
New language-based examples
- Loading branch information
Showing
12 changed files
with
191 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
docs/automations/standard/label-management/label-prs-by-language/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Automation - Label PRs by Language | ||
description: Automatically detect which programming languages are contained in PRs and automatically label the PRs appropriately. | ||
--- | ||
# Label PRs by Language | ||
|
||
<!-- --8<-- [start:example]--> | ||
Automatically detect which programming languages are contained in PRs and automatically label the PRs appropriately. | ||
|
||
 | ||
!!! info "Configuration Description" | ||
|
||
Conditions (all must be true): | ||
|
||
* A PR is created or updated. | ||
|
||
Automation Actions: | ||
|
||
* Label the PR for each programming language that is included. | ||
|
||
!!! example "Label PRs by Language" | ||
```yaml+jinja | ||
--8<-- "docs/downloads/automation-library/standard/label-management/label_prs_by_language.cm" | ||
``` | ||
<div class="result" markdown> | ||
<span> | ||
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/standard/label-management/label_prs_by_language.cm){ .md-button } | ||
</span> | ||
</div> | ||
|
||
<!-- --8<-- [end:example]--> | ||
|
Binary file added
BIN
+28.1 KB
...tions/standard/label-management/label-prs-by-language/label-prs-by-language.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
docs/automations/standard/summarize-language-changes/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: Automation - Summarize Language Changes | ||
description: Automatically post a comment that summarizes which programming languages are contained in PRs.. | ||
--- | ||
# Summarize Language Changes | ||
|
||
<!-- --8<-- [start:example]--> | ||
|
||
Post a comment that summarizes which programming languages are contained in PRs. | ||
|
||
<div class="automationImage" markdown="1"> | ||
 | ||
</div> | ||
|
||
<div class="automationDescription" markdown="1"> | ||
!!! info "Configuration Description" | ||
Conditions (all must be true): | ||
|
||
* A PR is created. | ||
|
||
Automation Actions: | ||
|
||
* Post a comment containing a table that shows the percent of total changes for each programming language present in the PR. | ||
</div> | ||
|
||
<div class="automationExample" markdown="1"> | ||
!!! example "Summarize Language Changes" | ||
```yaml+jinja | ||
--8<-- "docs/downloads/automation-library/standard/summarize_language_changes.cm" | ||
``` | ||
<div class="result" markdown> | ||
<span> | ||
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/standard/summarize_language_changes.cm){ .md-button } | ||
</span> | ||
</div> | ||
<!-- --8<-- [end:example]--> | ||
|
||
## Additional Resources | ||
|
||
--8<-- "docs/snippets/general.md" | ||
|
||
--8<-- "docs/snippets/automation-footer.md" |
Binary file added
BIN
+69.6 KB
.../automations/standard/summarize-language-changes/summarize-language-changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
docs/downloads/automation-library/standard/label-management/label_prs_by_language.cm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- mode: yaml -*- | ||
manifest: | ||
version: 1.0 | ||
|
||
automations: | ||
{% for item in labels %} | ||
label_{{ item.name }}_pr: | ||
if: | ||
- {{ files | match(regex=item.resources) | some }} | ||
run: | ||
- action: add-label@v1 | ||
args: | ||
label: '{{ item.name }}' | ||
{% endfor %} | ||
|
||
labels: | ||
- name: Java | ||
resources: r/.java$/ | ||
- name: Rust | ||
resources: r/.rs$/ | ||
- name: HTML | ||
resources: r/.html$/ | ||
- name: JavaScript | ||
resources: r/.js$/ | ||
- name: Python | ||
resources: r/.py$/ | ||
- name: Golang | ||
resources: r/.go$/ | ||
- name: Ruby | ||
resources: r/.rb$/ | ||
- name: CSS | ||
resources: r/.css/ | ||
|
63 changes: 63 additions & 0 deletions
63
docs/downloads/automation-library/standard/summarize_language_changes.cm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# -*- mode: yaml -*- | ||
manifest: | ||
version: 1.0 | ||
|
||
on: | ||
- pr_created | ||
|
||
automations: | ||
summarize_language_changes: | ||
if: | ||
- true | ||
run: | ||
- action: add-comment@v1 | ||
args: | ||
comment: | ||
<h3>Summary of Changes by Language</h3> | ||
<table> | ||
<tr> | ||
<td>Language</td> | ||
<td>Language Change Percentage</td> | ||
</tr> | ||
<tr> | ||
<td>Java</td> | ||
<td>{{ total.java | round }}%</td> | ||
</tr> | ||
<tr> | ||
<td>JavaScript</td> | ||
<td>{{ total.javascript | round }}%</td> | ||
</tr> | ||
<td>Rust</td> | ||
<td>{{ total.rust | round }}%</td> | ||
</tr> | ||
<tr> | ||
<td>Ruby</td> | ||
<td>{{ total.ruby | round }}%</td> | ||
</tr> | ||
<td>HTML</td> | ||
<td>{{ total.html | round }}%</td> | ||
</tr> | ||
<td>CSS</td> | ||
<td>{{ total.css | round }}%</td> | ||
</tr> | ||
<tr> | ||
<td>Golang</td> | ||
<td>{{ total.golang | round }}%</td> | ||
</tr> | ||
<tr> | ||
<td>Python</td> | ||
<td>{{ total.python | round }}%</td> | ||
</tr> | ||
</table> | ||
|
||
total: | ||
additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }} | ||
java: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.java$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
javascript: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.js$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
rust: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.rs$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
ruby: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.rb$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
html: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.html$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
css: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.css$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
golang: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.go$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
python: {{ branch.diff.files_metadata | filter(attr='file', regex=r/.py$/ ) | map(attr='additions') | sum / total.additions * 100 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters