Skip to content

Approve Safe Changes

Automatically approve PRs that change docs, tests, and other safe assets.

Approve safe changes

Configuration Description

Conditions (all must be true):

  • The PR only contains documentation, tests, or formatting changes.

Automation Actions:

  • Add a safe-change label
  • Approve the PR
  • Post a comment that explains that this is a safe change

Approve Safe Changes

# -*- mode: yaml -*-

  version: 1.0

    # Triggered for any changes that only affect formatting, documentation, tests, or images
      - {{ is.formatting or or is.tests or is.image }}
    # Apply a safe change label, approve the PR and explain why in a comment.
      - action: add-label@v1
          label: 'safe-change'
      - action: approve@v1
      - action: add-comment@v1
          comment: |
            This PR is considered a safe change and has been automatically approved.

# These custom expressions are used in the safe_changes automation
  formatting: {{ source.diff.files | isFormattingChange }}
  docs: {{ files | allDocs }}
  tests: {{ files | allTests }}
  image: {{ files | allImages }}

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.