Skip to content

Approve Tiny Changes

Approve single-line changes to a single file.

Approve tiny change

Configuration Description

Conditions (all must be true):

  • If the PR contains a one-line change to a single file.

Automation Actions:

  • Apply a single-line label.
  • Approve the PR.
  • Post a comment explaining why the PR was approved.

name

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  approve_tiny_change:
    # Triggered for PRs that contain one file and one line.
    if:
      - {{ is.one_file and is.one_line }}
    run:
      - action: add-label@v1
        args:
          label: 'single-line'
      - action: approve@v1
      - action: add-comment@v1
        args:
          comment: |
            This PR has been approved because it is only a single line

changes:
  # Sum all the lines added in the PR
  additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }}
  # Sum all the line removed in the PR
  deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }}

is:
  one_file: {{ files | length == 1 }}
  one_line: {{ changes.additions - changes.deletions <= 1 }}

Additional Resources

gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.

Learn More about how gitStream Works.

Related Automations:

More Automations can be found on the Automation Library and Integrations pages.