Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding file and line size automations #439

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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,32 @@
---
title: gitStream Automation - Skip GitHub Action Checks for Urgent PRs.
description: Automatically unblock CI pipelines for urgent PRs that need to be merged quickly.
---
# Skip GitHub Action Checks for Urgent PRs
<!-- --8<-- [start:example]-->
Automatically unblock CI pipelines for urgent PRs that need to be merged quickly.

![Skip GitHub Action Checks for Urgent PRs](/automations/integrations/github-actions/skip-github-action-checks-for-urgent-prs/skip-github-action-checks-for-urgent-prs.png)

!!! info "Configuration Description"

**Conditions (all must be true):**

* A PR has a label applied to it that says “urgent” or someone posts `/gitstream urgent` as a comment.

**Automation Actions:**

* Skip a predetermined list of GitHub Actions

<div class="automationExample" markdown="1">
!!! example "Skip GitHub Action Checks for Urgent PRs"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/github-actions/skip-github-action-checks-for-urgent-prs/skip_github_action_checks_for_urgent_prs.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/github-actions/skip-github-action-checks-for-urgent-prs/skip_github_action_checks_for_urgent_prs.cm){ .md-button }
</span>
</div>
<!-- --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.
32 changes: 32 additions & 0 deletions docs/automations/standard/enforce-changed-file-limit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: gitStream Automation - Enforce a Maximum Number of Files That Can Be Changed in a PR.
description: Automatically enforce a maximum number of files that can be changed in a PR.
---
# Enforce a Maximum Number of Files That Can Be Changed in a PR
<!-- --8<-- [start:example]-->
Automatically enforce a maximum number of files that can be changed in a PR.

![Enforce Changed File Limit](/automations/standard/enforce-changed-file-limit/enforce-changed-file-limit.png)

!!! info "Configuration Description"

**Conditions (all must be true):**

* The PR changes a number of files that exceeds a specified value.

**Automation Actions:**

* Request changes and post a comment asking the PR author to break up the changes.

<div class="automationExample" markdown="1">
!!! example "Enforce a Maximum Number of Files That Can Be Changed in a PR"
```yaml+jinja
--8<-- "docs/downloads/automation-library/standard/enforce-changed-file-limit/enforce_changed_file_limit.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/standard/enforce-changed-file-limit/enforce_changed_file_limit.cm){ .md-button }
</span>
</div>
<!-- --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.
32 changes: 32 additions & 0 deletions docs/automations/standard/enforce-changed-lines-limit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: gitStream Automation - Enforce a Maximum Number of Lines That Can Be Changed in a PR.
description: Automatically enforce a maximum number of lines that can be changed in a PR.
---
# Enforce a Maximum Number of Lines That Can Be Changed in a PR
<!-- --8<-- [start:example]-->
Automatically enforce a maximum number of lines that can be changed in a PR.

![Enforce Changed Line Limit](/automations/standard/enforce-changed-lines-limit/enforce-changed-lines-limit.png)

!!! info "Configuration Description"

**Conditions (all must be true):**

* The PR changes a number of lines that exceeds a specified value.

**Automation Actions:**

* Request changes and post a comment asking the PR author to break up the changes.

<div class="automationExample" markdown="1">
!!! example "Enforce a Maximum Number of Lines That Can Be Changed in a PR"
```yaml+jinja
--8<-- "docs/downloads/automation-library/standard/enforce-changed-lines-limit/enforce_changed_lines_limit.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/standard/enforce-changed-lines-limit/enforce_changed_lines_limit.cm){ .md-button }
</span>
</div>
<!-- --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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
manifest:
version: 1.0

on:
- comment_added
- label_added

automations:
skip_github_action_checks_for_urgent_prs:
if:
- {{ is.requested or is.label }}
run:
- action: add-github-check@v1
args:
check_name: deployment-ci
conclusion: skipped
is:
requested: {{ pr.comments | match(attr='content', term='/gitstream urgent') | some }}
label: {{ pr.labels | match(term='urgent') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
manifest:
version: 1.0

automations:
enforce_changed_file_limit:
if:
- {{ files | length > 10 }}
run:
- action: request-changes@v1
args:
comment: |
Our goal is to keep PRs under 10 changed files, and this PR modifies more than 10 files. Please consider breaking this PR up into smaller components to make code reviews easier.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
manifest:
version: 1.0

automations:
enforce_changed_lines_limit:
if:
- {{ branch.diff.size > 250 }}
run:
- action: request-changes@v1
args:
comment: |
Our goal is to keep PRs under 250 lines of code changed, and this PR modifies more than 250 lines of code. Please consider breaking this PR up into smaller components to make code reviews easier.