Skip to content

Label PRs by Language

Automatically detect which programming languages are contained in PRs and automatically label the PRs appropriately.

Label PRs by Language

Configuration Description

Conditions (all must be true):

  • A PR is created or updated.

Automation Actions:

  • Label the PR for each programming language that is included.

Label PRs by Language

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

automations:
  {% for item in labels %}
  label_{{ item.name }}_pr:
      if:
        - {{ files | match(regex=item.resources) | some }}
      run:
        - action: add-label@v1
          args:
            label: '{{ item.name }}'
  {% endfor %}

labels:
  - name: Java
    resources: r/.java$/
  - name: Rust
    resources: r/.rs$/
  - name: HTML
    resources: r/.html$/
  - name: JavaScript
    resources: r/.js$/
  - name: Python
    resources: r/.py$/
  - name: Golang
    resources: r/.go$/
  - name: Ruby
    resources: r/.rb$/
  - name: CSS
    resources: r/.css/

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.