/probot-require-label

A Probot that applies a label to issues and/or PRs that do not have any labels matching a regular expression

Primary LanguageTypeScriptMIT LicenseMIT

Require Label Bot

Downloads version Build Status

A Probot bot to make sure that a given label is added to specific issues and pull requests when all other labels do not match a regex.

Setup

Add a .github/relabel.yml file to your repository and then run the bot against it.

If the config is empty or doesn't exist, the bot will not run.

# This example configuration will add the `needs-area` and `needs-type` labels
# to any new issue and pull request that do not have labels matching `area:.*` or `type:.*`.
# Once the issue or the pull request has the `area:.....` label added the `needs-area` label will be 
# removed from the issue or pull request.
issues:
    # The missing label which will be added to issues if the regex doesn't match any other labels
  - missingLabel: needs-area
    regex: area:.*
  - missingLabel: needs-type
    regex: type:.*
pulls:
    # The missing label which will be added to pull requests if the regex doesn't match any other labels
  - missingLabel: needs-area
    regex: area:.*
  - missingLabel: needs-type
    regex: type:.*

Backwards compatibility

Previous version of the bot will still work with current version, as the schema for the configuration file does not change the structure. So it's possible to upgrade and keep old configuration:

# The old format matches the new one, using a different name
requiredLabels:
  - missingLabel: needs-area
    regex: area:.*
  - missingLabel: needs-type
    regex: type:.*

Contribute

If you have suggestions for how this bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.