Automated Labels

This public content is an excerpt from Flutter staff GitHub docs. It is published as a reference to show how GitHub is used for inner source at Flutter.

The PR and Issue labelling automation applies division labels to pull requests and issues.

This automation helps the user by:

  • Automatically adding the division label of an approver, that is a maintainer, to a pull-request;
  • Automatically adding the division label of an issue creator;
  • Warning a pull-request creator whenever the labels major, minor and documentation, enhancement, bug have not been applied and a comment will be added to the PR to remind the creator.

Enabling and configuring the labelling automation

The labelling automation is enabled in the org-config capability/repository configuration files and follows the Codebase Governor rules and definition structure:

  • Capability defaults are defined in a _defaults.yml file in this YAML format.
  • Capability defaults will be applied to the repository if they are defined. Any capability default can be overridden if required in the repository config;
  • The repository config file is located at codebases/<capability name>/<repository name>.yml. If non existent you can create a new repository configuration file.

Configuration is slightly different between capability and repository config file.

In a capability you can define the defaults to be applied to the repositories like:

defaults:
  labels: 
    pr-reviewer-division: true
    issue-author-division: true
    pr-size-reminder: true

In a repository you don’t need the defaults key:

labels: 
  pr-reviewer-division: true
  issue-author-division: true
  pr-size-reminder: true

Labels section keys

labels

The labels section enables and specifies the automatic labelling behaviour for PRs and Issues.

labels.pr-reviewer-division

Add the pull request reviewer division when opening a new pull request.

labels.issue-author-division

Add the issue creator division when opening a issue.

labels.pr-size-reminder

Warn the user whenever the labels major, minor and documentation, enhancement, bug have not been applied, via a comment in the pull request.

pr-size-reminder comment example

Capability and Repository full examples

Capability configuration

description: >
  Inner Source documentation.
owner: owner-1
maintainers:
  - maintainer-1
  - maintainer-3
  - maintainer-3
  - maintainer-4

defaults:
  contributors:
    teams: [ all-users ]
  labels:
    pr-reviewer-division: true
    issue-author-division: true
    pr-size-reminder: true

Repository configuration

description: >
  Internal inner source site and service.
labels:
  pr-author-division: true
  pr-size-reminder: true

Feel free to reach out to the inner source team for any assistance.