Skip to content

Label Deleted Files

Label PRs that delete files.

Label Deleted Files

Configuration Description

Conditions (all must be true):

  • The PR deletes one or more files.

Automation Actions:

  • Apply a deleted-files label to the PR.

Label Deleted Files

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

automations:
  # Apply a label that indicates when a PR deletes files
  # This uses the `has` custom expression found at the bottom of this file
  label_deleted_files:
    if:
      - {{ has.deleted_files }}
    run: 
      - action: add-label@v1
        args:
          label: 'deleted-files'
          color: '#DF9C04'

# This is used in the `label_deleted_files` automation
has:
  deleted_files: {{ source.diff.files | map(attr='new_file') | match(term='/dev/null') | some }}

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.