Skip to content

Change Deprecated Components

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

Change Deprecated Components

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 -*-
  version: 1.0

  # 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
  catch_deprecated_components_{{ loop.index }}:
    # Triggered when any of the modified files use a deprecated component
      - {{ source.diff.files | matchDiffLines(regex=item.regex) | some }}
    # Apply a deprecated-component label, request changes, and post a comment with an explanation.
      - action: add-label@v1
          label: 'deprecated-component'
          color: '#FF0000'
      - action: request-changes@v1
          comment: |
            `{{ item.old }}` component is deprecated, use `{{ }}` instead
  {% endfor %}

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