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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation and tests for label changelog label section assignment behavior #822

Merged
merged 5 commits into from Dec 22, 2019

Conversation

bnigh
Copy link
Contributor

@bnigh bnigh commented Dec 19, 2019

What Changed

  • Took attempt at updating label config docs to better communicate (a) default labels & (b) how PRs are assigned to a label section
  • Added a few tests for changelog / releaseNote generation to check for documented behavior

Why

  • To improve accessibility of new auto users to understand what the default changelog / release notes will look like and how they might modify the config to achieve desired customization
  • See this comment

Todo:

  • Add tests
  • Add docs

Callouts

  • I'm not 100% liking the way the changes to the docs turned out so far... but wanted to create a PR to get feedback / start the conversation of how to best improve the existing docs

Published PR with canary version:

Published under canary scope @auto-canary

  • @auto-canary/auto@8.7.3-canary.822.10958.0
  • @auto-canary/core@8.7.3-canary.822.10958.0
  • @auto-canary/all-contributors@8.7.3-canary.822.10958.0
  • @auto-canary/chrome@8.7.3-canary.822.10958.0
  • @auto-canary/conventional-commits@8.7.3-canary.822.10958.0
  • @auto-canary/crates@8.7.3-canary.822.10958.0
  • @auto-canary/first-time-contributor@8.7.3-canary.822.10958.0
  • @auto-canary/git-tag@8.7.3-canary.822.10958.0
  • @auto-canary/jira@8.7.3-canary.822.10958.0
  • @auto-canary/maven@8.7.3-canary.822.10958.0
  • @auto-canary/npm@8.7.3-canary.822.10958.0
  • @auto-canary/omit-commits@8.7.3-canary.822.10958.0
  • @auto-canary/omit-release-notes@8.7.3-canary.822.10958.0
  • @auto-canary/released@8.7.3-canary.822.10958.0
  • @auto-canary/s3@8.7.3-canary.822.10958.0
  • @auto-canary/slack@8.7.3-canary.822.10958.0
  • @auto-canary/twitter@8.7.3-canary.822.10958.0
  • @auto-canary/upload-assets@8.7.3-canary.822.10958.0

@codecov
Copy link

codecov bot commented Dec 19, 2019

Codecov Report

Merging #822 into master will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #822      +/-   ##
==========================================
+ Coverage   85.39%   85.47%   +0.07%     
==========================================
  Files          36       36              
  Lines        2404     2402       -2     
  Branches      337      309      -28     
==========================================
  Hits         2053     2053              
+ Misses        274      272       -2     
  Partials       77       77
Impacted Files Coverage Δ
packages/core/src/auto.ts 85.46% <0%> (+0.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a915ba1...0d286f9. Read the comment docs.

Copy link
Collaborator

@hipstersmoothie hipstersmoothie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great additions to the docs ❤️

<details><summary>Click here to see the default label configuration</summary>

```json
[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition!

#### Changelog Titles

By default auto will create sections in the changelog for the following labels.
Each PR included in the release will be matched to the first label defined in the config with a `changelogTitle` in priority order of the `releaseType` (major, minor, patch, then all others) and included as an entry within that section
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each PR included in the release will be matched to the first label defined in the config with a `changelogTitle` in priority order of the `releaseType` (major, minor, patch, then all others) and included as an entry within that section
Each PR included in the release will be matched to the first label defined in the config with a `changelogTitle`.
All matching commits are grouped together and rendered as one section in the changelog.
Sections are in priority order based on the `releaseType` (`major`, `minor`, `patch, then all others).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hipstersmoothie
I agree that the wording can be improved...

One piece of info that we may lose by removing that wording is the following scenario:

my config

{
  "labels": [
    { "releaseType": "none", "name": "foo", "changelogTitle": "Foo" },
    { "releaseType": "minor", "name": "bar", "changelogTitle": "Bar" }
  ]
}

if a PR has both foo and bar labels, then technically, the first label in the config is foo, but the PR would be assigned to the bar section.

This likely will not be a common use case, but wondering if it is worth keeping the info in the docs in a different format for completeness.

What are your thoughts?

Copy link
Contributor Author

@bnigh bnigh Dec 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hipstersmoothie

Ah I see. I just wanted to break up the sentence a little bit. I agree with
you we should keep the original wording maybe a little clearer

Definitely open to suggestions about how to improve the wording.

How about rewording to something like below?


Changelog Titles

Each PR included in the release will be assigned to a label section based upon the matching label with the highest releaseType that has a changelogTitle.

  • Priority order of releaseType from highest to lowest: major, minor, patch, and then all others
  • If a PR has multiple labels of the same releaseType, then the PR is assigned based upon the label that is assigned first in the config

By default auto will create sections in the changelog for the following labels:

  • major
  • minor
  • patch
  • internal
  • documentation

For example:

  • Using the default config, if a given PR has the labels minor and internal, then it will be included in the minor label section
  • Using the default config, if a given PR has the labels documentation and internal, then it will be included in the internal label section

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be addressed in: 0d286f9

@@ -200,6 +199,78 @@ describe('generateReleaseNotes', () => {
expect(await changelog.generateReleaseNotes(normalized)).toMatchSnapshot();
});

test('should prefer section with highest releaseType for PR with multiple labels', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you used test to validate how it works for your docs! Awesome :shipit:

@hipstersmoothie
Copy link
Collaborator

hipstersmoothie commented Dec 20, 2019 via email

@hipstersmoothie hipstersmoothie added the documentation Changes only affect the documentation label Dec 22, 2019
@hipstersmoothie hipstersmoothie merged commit 97cff20 into intuit:master Dec 22, 2019
@adierkens
Copy link
Collaborator

🚀 PR was released in v8.8.0 🚀

@adierkens adierkens added the released This issue/pull request has been released. label Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants