Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

flag unlabeled PRs with wildcard label #1

Merged
merged 2 commits into from
Aug 6, 2019
Merged

Conversation

NathanPJF
Copy link
Owner

@NathanPJF NathanPJF commented Jun 27, 2019

Purpose

Exploring how to use lerna-changelog to identify unlabeled PRs that we committed. Related issue: lerna#74

Result

Example from my testing:

## Unreleased (2019-05-04)

#### 馃殌 Enhancement
* [#838](https://github.com/foo/bar/pull/838) Update search results layout ([@NathanPJF](https://github.com/nathanpjf))

#### 鈿狅笍 Unlabeled
* [#903](https://github.com/foo/bar/pull/903) Unhide mute button ([@somePerson](https://github.com/somePerson))
* [#923](https://github.com/foo/bar/pull/923) Convert hardcoded values ([@somePerson](https://github.com/somePerson))

Approach

Check all the labels on a commit, if none of them match the labels in the config file, this tool adds a label to the commit. This makes sure that when commit.categories is built, the commit is included since it is now labeled.

A developer can use the existing labels config to decide what heading goes on it in the terminal output.

  "changelog": {
    "labels": {
      "breaking change": "馃挜 Breaking Change",
      "enhancement": "馃殌 Enhancement",
      "docs": "馃摑 Documentation",
      "bug fix": "馃悰 Bug fixes",
      "unlabeled": "鈿狅笍 Unlabeled"
    },
    "wildcardLabel": "unlabeled",
    "cacheDir": ".changelog"
  }

This wildcardLabel feature is optional because it means any commit to master that isn't using a label from the config's labels is going to get flagged. That's great if you want to make sure you review every PR in the terminal output, but might be annoying if you feel you are super diligent about labeling your PRs and don't need a reminder.

Pros:

  • The value for wildcardLabel can match a real label being used by the development team and still get the desired result. In fact, it can add as a safeguard for times people forget to put this unlabeled label.

Questions:

What do you do when wildcardLabel has a value, but no matching key in unlabeled? Provide a default message?

In lerna-changelog configuration, there is a default title for nextVersion of "Unreleased". I could go with a default heading for unlabeled PRs, and if someone wants a specific heading, they just need to add it to the labels config.

Decision: I decided to provide a default in the configuration.ts so that a default heading is provided. The user can override this by providing a value for the same label in the labels property.

@NathanPJF
Copy link
Owner Author

NathanPJF commented Jun 28, 2019

Other idea

Instead of having the value for wildcardLabel be the label name, have it be an object like flagUnlabeled with both the label name and the heading.

"flagUnlabeled": {
  "unlabeled" : "This commit was unlabeled"
}

Pros:

  • This wouldn't require the developer to put a "fake" label entry in the config's labels object.

Questions:

  • If unlabeled shows up in both labels and flagUnlabeled, which heading do you go with?
  "changelog": {
    "labels": {
      "breaking change": "馃挜 Breaking Change",
      "enhancement": "馃殌 Enhancement",
      "docs": "馃摑 Documentation",
      "bug fix": "馃悰 Bug fixes",
      "unlabeled": "鈿狅笍 Unlabeled"
    },
    flagUnlabeled: {
      'unlabeled' : "鈿狅笍 Unlabeled"
    },
    "cacheDir": ".changelog"
  }

@NathanPJF NathanPJF changed the title WIP: flag unlabeled PRs flag unlabeled PRs with wildcard label Jun 28, 2019
@NathanPJF NathanPJF merged commit fbb45fa into master Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant