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

Changelog automation: apply proper top-level categorization precedence to meta PRs #50208

Merged
merged 5 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ const UNKNOWN_FEATURE_FALLBACK_NAME = 'Uncategorized';
* @type {Record<string,string>}
*/
const LABEL_TYPE_MAPPING = {
'[Feature] Navigation Screen': 'Experiments',
'[Package] Dependency Extraction Webpack Plugin': 'Tools',
'[Type] Developer Documentation': 'Documentation',
'[Package] Jest Puppeteer aXe': 'Tools',
'[Package] E2E Tests': 'Tools',
'[Package] E2E Test Utils': 'Tools',
Expand All @@ -74,16 +73,17 @@ const LABEL_TYPE_MAPPING = {
'[Package] Scripts': 'Tools',
'[Type] Build Tooling': 'Tools',
'Automated Testing': 'Tools',
'[Package] Dependency Extraction Webpack Plugin': 'Tools',
'[Type] Code Quality': 'Code Quality',
'[Type] Performance': 'Performance',
'[Type] Security': 'Security',
'[Feature] Navigation Screen': 'Experiments',
'[Type] Experimental': 'Experiments',
'[Type] Bug': 'Bug Fixes',
'[Type] Regression': 'Bug Fixes',
'[Type] Feature': 'Features',
'[Type] Enhancement': 'Enhancements',
'[Type] New API': 'New APIs',
'[Type] Performance': 'Performance',
'[Type] Developer Documentation': 'Documentation',
'[Type] Code Quality': 'Code Quality',
'[Type] Security': 'Security',
'[Type] Feature': 'Features',
};

/**
Expand Down Expand Up @@ -303,12 +303,6 @@ function getIssueType( issue ) {
...getTypesByTitle( issue.title ),
];

// Force all tasks identified as Documentation tasks
// to appear under the main "Documentation" section.
if ( candidates.includes( 'Documentation' ) ) {
return 'Documentation';
}

return candidates.length ? candidates.sort( sortType )[ 0 ] : 'Various';
}

Expand Down Expand Up @@ -377,7 +371,7 @@ function getIssueFeature( issue ) {
*/
function sortType( a, b ) {
const [ aIndex, bIndex ] = [ a, b ].map( ( title ) => {
return Object.keys( LABEL_TYPE_MAPPING ).indexOf( title );
return Object.values( LABEL_TYPE_MAPPING ).indexOf( title );
} );

return aIndex - bIndex;
Expand Down
33 changes: 17 additions & 16 deletions bin/plugin/commands/test/__snapshots__/changelog.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ exports[`getChangelog verify that the changelog is properly formatted 1`] = `

### Enhancements

- Scripts: Use cssnano to minimize CSS files with build. ([33750](https://github.com/WordPress/gutenberg/pull/33750))
- Scripts: Webpack configuration update to minimize CSS. ([33676](https://github.com/WordPress/gutenberg/pull/33676))

#### Components
- Add new ColorPicker. ([33714](https://github.com/WordPress/gutenberg/pull/33714))
- Promote \`ItemGroup\`. ([33701](https://github.com/WordPress/gutenberg/pull/33701))
- Update snackbar to use framer motion instead of react spring. ([33717](https://github.com/WordPress/gutenberg/pull/33717))
- Use updated range styles. ([33824](https://github.com/WordPress/gutenberg/pull/33824))

Expand Down Expand Up @@ -39,7 +35,6 @@ exports[`getChangelog verify that the changelog is properly formatted 1`] = `
### Bug Fixes

- Correct \`function_exists()\` check typo introduced in #33331. ([33513](https://github.com/WordPress/gutenberg/pull/33513))
- ESLint Plugin: Include .jsx extenstion when linting import statements. ([33746](https://github.com/WordPress/gutenberg/pull/33746))
- Fix block appender position in classic themes. ([33895](https://github.com/WordPress/gutenberg/pull/33895))
- Fix misspelling of "queries" in filter documentation. ([33799](https://github.com/WordPress/gutenberg/pull/33799))
- Fix positioning discrepancy with draggable chip. ([33893](https://github.com/WordPress/gutenberg/pull/33893))
Expand Down Expand Up @@ -81,12 +76,6 @@ exports[`getChangelog verify that the changelog is properly formatted 1`] = `
#### Meta Boxes
- Fix Safari 13 metaboxes from overlapping the content. ([33817](https://github.com/WordPress/gutenberg/pull/33817))

#### Build Tooling
- Readable JS assets Plugin: Fix webpack 5 support. ([33785](https://github.com/WordPress/gutenberg/pull/33785))

#### Navigation Screen
- Fix regressed menu selection dropdown placeholder value for Nav Editor menu locations UI. ([33748](https://github.com/WordPress/gutenberg/pull/33748))

#### Accessibility
- Fix some JAWS bugs. ([33627](https://github.com/WordPress/gutenberg/pull/33627))

Expand Down Expand Up @@ -116,6 +105,15 @@ exports[`getChangelog verify that the changelog is properly formatted 1`] = `
- Refactor the HierarchicalTermSelector so that it does not cause unnecessary loading of terms. ([33418](https://github.com/WordPress/gutenberg/pull/33418))


### Experiments

#### Navigation Screen
- Fix regressed menu selection dropdown placeholder value for Nav Editor menu locations UI. ([33748](https://github.com/WordPress/gutenberg/pull/33748))

#### Components
- Promote \`ItemGroup\`. ([33701](https://github.com/WordPress/gutenberg/pull/33701))


### Documentation

- Add documentation to disable remote calls for block patterns. ([33930](https://github.com/WordPress/gutenberg/pull/33930))
Expand All @@ -133,8 +131,6 @@ exports[`getChangelog verify that the changelog is properly formatted 1`] = `

### Code Quality

- Scripts: Fix typo in format change message. ([33945](https://github.com/WordPress/gutenberg/pull/33945))

#### Components
- Components utils: \`rtl()\` return type, \`rtl.watch()\` utility. ([33882](https://github.com/WordPress/gutenberg/pull/33882))
- InputControl to TypeScript. ([33696](https://github.com/WordPress/gutenberg/pull/33696))
Expand All @@ -157,17 +153,22 @@ exports[`getChangelog verify that the changelog is properly formatted 1`] = `

### Tools

- ESLint Plugin: Include .jsx extenstion when linting import statements. ([33746](https://github.com/WordPress/gutenberg/pull/33746))
- GitHub Templates: Fix spacing in bug report template. ([33761](https://github.com/WordPress/gutenberg/pull/33761))
- GitHub Templates: Format bug report template. ([33786](https://github.com/WordPress/gutenberg/pull/33786))
- Scripts: Fix typo in format change message. ([33945](https://github.com/WordPress/gutenberg/pull/33945))
- Scripts: Use cssnano to minimize CSS files with build. ([33750](https://github.com/WordPress/gutenberg/pull/33750))
- Scripts: Webpack configuration update to minimize CSS. ([33676](https://github.com/WordPress/gutenberg/pull/33676))
- Update bug issue template to use forms. ([33713](https://github.com/WordPress/gutenberg/pull/33713))

#### Build Tooling
- Readable JS assets Plugin: Fix webpack 5 support. ([33785](https://github.com/WordPress/gutenberg/pull/33785))
- Scripts: Update webpack to v5 (try 2). ([33818](https://github.com/WordPress/gutenberg/pull/33818))

#### Testing
- Add search performance measure and make other measures more stable. ([33848](https://github.com/WordPress/gutenberg/pull/33848))
- E2E: Block Hierarchy Navigation wait for the column to be highlighted. ([33721](https://github.com/WordPress/gutenberg/pull/33721))

#### Build Tooling
- Scripts: Update webpack to v5 (try 2). ([33818](https://github.com/WordPress/gutenberg/pull/33818))


### Various

Expand Down
11 changes: 11 additions & 0 deletions bin/plugin/commands/test/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ describe( 'getIssueType', () => {

expect( result ).toBe( 'Enhancements' );
} );

it( 'prioritizes meta categories', () => {
const result = getIssueType( {
labels: [
{ name: '[Type] Bug' },
{ name: '[Type] Build Tooling' },
],
} );

expect( result ).toBe( 'Tools' );
} );
} );

describe( 'getIssueFeature', () => {
Expand Down