Skip to content

Change Deprecated Components

Request changes when a PR includes one or more deprecated components.

Change Deprecated Components

Configuration Description

Conditions (all must be true):

  • A PR contains one or more references to functions, methods, or classes that have been designated as deprecated.

Automation Actions:

  • Add a deprecated-component label to the PR
  • Request changes to the PR and post a comment that explains what deprecated component was included and what the alternative is.

Change Deprecated Components

# -*- mode: yaml -*-
manifest:
  version: 1.0

automations:
  # Request changes when a PR includes deprecated components.
  # This requires the `item` custom expression found at the bottom of this file.
  {% for item in deprecated %}
  # Automation names must be unique, so this adds an iterator index to each instance
  review_deprecated_component_{{ item.old }}:
    # Triggered when any of the modified files use a deprecated component
    if:
      - {{ source.diff.files | matchDiffLines(regex=item.regex) | some }}
    # Apply a deprecated-component label, request changes, and post a comment with an explanation.
    run:
      - action: add-label@v1
        args:
          label: 'deprecated-component'
          color: '#FF0000'
      - action: request-changes@v1
        args:
          comment: |
            `{{ item.old }}` component is deprecated, use `{{ item.new }}` instead
  {% endfor %}

# These are the deprecated files that are evaluated in catch_deprecated_components
deprecated:
  - regex: r/oldAPI/
    old: oldAPI
    new: newAPI
  - regex: r/anotherOldAPI/
    old: anotherOldAPI
    new: anotherNewAPI

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.