Skip to content

Label Based on Modified Resources

Automatically label PRs to indicate what resources are being changed.

Label Modified Resources

Configuration Description

Conditions (all must be true):

  • A PR is created or updated.

Automation Actions:

  • Apply labels based on the branch name or modified resources.

Label Modified Resources

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

automations:
  {% for item in labels %}
  label_resource_{{ item.name }}:
      if:
        -{{ branch.name | includes(regex=item.branch) or files | match(list=item.resources) }}
      run:
        - action: add-label@v1
          args:
            label: {{ item.name }}
  {% endfor %}

labels:
  - name: Core
    resources:
    - src/app
    branch: r/^core-/
  - name: mobile
    resources:
    - src/android
    - src/ios
    branch: r/^mobile-/

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.