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

Automated Changelog: Sort feature groups by issue name #34071

Merged
merged 3 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 21 additions & 5 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,24 @@ function getEntry( issue ) {
: `- ${ title } ([${ issue.number }](${ issue.html_url }))`;
}

/**
* Returns a formatted changelog entry for a given issue object and matching feature name, or undefined
* if entry should be omitted.
*
* @param {IssuesListForRepoResponseItem} issue Issue object.
* @param {string} featureName Feature name.
*
* @return {string=} Formatted changelog entry, or undefined to omit.
*/
function getFeatureEntry( issue, featureName ) {
return getEntry( issue )
?.replace(
new RegExp( `\\[${ featureName.toLowerCase() } \- `, 'i' ),
'['
)
.replace( new RegExp( `${ featureName.toLowerCase() }: `, 'i' ), '' );
}

/**
* Returns the latest release for a given series
*
Expand Down Expand Up @@ -682,8 +700,9 @@ function formatChangelog( pullRequests ) {
const featureGroupPRs = featureGroups[ featureName ];

const featureGroupEntries = featureGroupPRs
.map( getEntry )
.filter( Boolean );
.map( ( issue ) => getFeatureEntry( issue, featureName ) )
.filter( Boolean )
.sort();

// Don't create feature sections when there are no PRs.
if ( ! featureGroupEntries.length ) {
Expand All @@ -702,9 +721,6 @@ function formatChangelog( pullRequests ) {

// Add a <li> for each PR in the Feature.
featureGroupEntries.forEach( ( entry ) => {
// Strip feature name from entry if present.
entry = entry && entry.replace( `[${ featureName } - `, '[' );

// Add a new bullet point to the list.
changelog += `${ entry }\n`;
} );
Expand Down
68 changes: 34 additions & 34 deletions bin/plugin/commands/test/__snapshots__/changelog.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ exports[`formatChangelog verify that the changelog is properly formatted 1`] = `
- Scripts: Webpack configuration update to minimize CSS. ([33676](https://github.com/WordPress/gutenberg/pull/33676))

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

#### Block Library
- [Post Featured Image]: Add basic dimension controls. ([31634](https://github.com/WordPress/gutenberg/pull/31634))

#### Site Editor
- Site Editor: Add error boundary. ([33921](https://github.com/WordPress/gutenberg/pull/33921))
- Add error boundary. ([33921](https://github.com/WordPress/gutenberg/pull/33921))

#### Widgets Editor
- Add error boundaries to widget screens. ([33771](https://github.com/WordPress/gutenberg/pull/33771))

#### Patterns
- Block patterns: Add translation context on titles. ([33734](https://github.com/WordPress/gutenberg/pull/33734))
- Block Add translation context on titles. ([33734](https://github.com/WordPress/gutenberg/pull/33734))
Copy link
Member Author

Choose a reason for hiding this comment

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

This one is strange, but I haven't found an easy way to tweak the regular expression.

Copy link
Contributor

Choose a reason for hiding this comment

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

I left a suggestion above to prevent this. It would still output Block patterns as a feature in the Patterns section unless we start over-optimizing the expression with things like (Block(s)?\s*)?, which seems overkill and not worth the extra polishing time it represents.

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied. It works perfectly fine 👍🏻


#### Document Settings
- Disable spellcheck and autocomplete in permalink slug field. ([33708](https://github.com/WordPress/gutenberg/pull/33708))
Expand All @@ -36,47 +36,47 @@ exports[`formatChangelog 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 positioning discrepancy with draggable chip. ([33893](https://github.com/WordPress/gutenberg/pull/33893))
- Fix misspelling of \\"queries\\" in filter documentation. ([33799](https://github.com/WordPress/gutenberg/pull/33799))
- ESLint Plugin: Include .jsx extenstion when linting import statements. ([33746](https://github.com/WordPress/gutenberg/pull/33746))
- Correct \`function_exists()\` check typo introduced in #33331. ([33513](https://github.com/WordPress/gutenberg/pull/33513))
- Fix positioning discrepancy with draggable chip. ([33893](https://github.com/WordPress/gutenberg/pull/33893))

#### Block Library
- Fix justification for button block when selected. ([33739](https://github.com/WordPress/gutenberg/pull/33739))
- Fix navigation block appender invalid html. ([33964](https://github.com/WordPress/gutenberg/pull/33964))
- Image Block: Fix issue with canInsertCover not being set to false for empty arrays. ([33863](https://github.com/WordPress/gutenberg/pull/33863))
- Fix justification for button block when selected. ([33739](https://github.com/WordPress/gutenberg/pull/33739))
- [Query Pagination Numbers]: Fix first page's link. ([33629](https://github.com/WordPress/gutenberg/pull/33629))

#### Components
- \`useBreakpointIndex\`: Attach \`resize\` event listener to \`window\` instead of \`document\`. ([33902](https://github.com/WordPress/gutenberg/pull/33902))
- Components: Fix RTL on custom gradient picker. ([33831](https://github.com/WordPress/gutenberg/pull/33831))
- Fix RTL on custom gradient picker. ([33831](https://github.com/WordPress/gutenberg/pull/33831))
- FontSizePicker: Use number values when the initial value is a number. ([33679](https://github.com/WordPress/gutenberg/pull/33679))
- FormTokenField: Avoid error when maxLength value is hit. ([33623](https://github.com/WordPress/gutenberg/pull/33623))
- \`useBreakpointIndex\`: Attach \`resize\` event listener to \`window\` instead of \`document\`. ([33902](https://github.com/WordPress/gutenberg/pull/33902))

#### Block Editor
- URL Details: Avoid PHP notice when parsing protocol-relative icon URLs. ([33779](https://github.com/WordPress/gutenberg/pull/33779))
- Force link text to wrap in the Link UI when encountering extra long link text. ([33753](https://github.com/WordPress/gutenberg/pull/33753))
- Only show rich preview for image and description if data is available. ([33660](https://github.com/WordPress/gutenberg/pull/33660))
- Improve display of LinkURL menu and fix spacing. ([33652](https://github.com/WordPress/gutenberg/pull/33652))
- Only show rich preview for image and description if data is available. ([33660](https://github.com/WordPress/gutenberg/pull/33660))
- URL Details: Avoid PHP notice when parsing protocol-relative icon URLs. ([33779](https://github.com/WordPress/gutenberg/pull/33779))

#### Global Styles
- Avoid rendering duplicate elements stylesheet. ([33680](https://github.com/WordPress/gutenberg/pull/33680))
- Fix Global Styles transient key clash. ([33844](https://github.com/WordPress/gutenberg/pull/33844))
- Site editor: Fix presets for blocks with multiple selectors. ([33951](https://github.com/WordPress/gutenberg/pull/33951))
- Global Styles: Fix Global Styles transient key clash. ([33844](https://github.com/WordPress/gutenberg/pull/33844))
- Global Styles: Avoid rendering duplicate elements stylesheet. ([33680](https://github.com/WordPress/gutenberg/pull/33680))

#### CSS & Styling
- Fix navigation block placeholder preview markup. ([33963](https://github.com/WordPress/gutenberg/pull/33963))

#### Navigation Screen
- Navigation Editor: Avoid React warning when creating a new menu. ([33843](https://github.com/WordPress/gutenberg/pull/33843))
- Fix regressed menu selection dropdown placeholder value for Nav Editor menu locations UI. ([33748](https://github.com/WordPress/gutenberg/pull/33748))
- Navigation Editor: Avoid React warning when creating a new menu. ([33843](https://github.com/WordPress/gutenberg/pull/33843))

#### Site Editor
- Fix the site editor breaking in firefox. ([33896](https://github.com/WordPress/gutenberg/pull/33896))

#### Editor
- Editor: Safer isPreviewingPost check. ([33840](https://github.com/WordPress/gutenberg/pull/33840))
- Safer isPreviewingPost check. ([33840](https://github.com/WordPress/gutenberg/pull/33840))

#### Meta Boxes
- Fix Safari 13 metaboxes from overlapping the content. ([33817](https://github.com/WordPress/gutenberg/pull/33817))
Expand All @@ -96,12 +96,12 @@ exports[`formatChangelog verify that the changelog is properly formatted 1`] = `
- Avoid double parsing the content when loading the editor. ([33727](https://github.com/WordPress/gutenberg/pull/33727))

#### Block Library
- Improve the rendering/update performance of the image block. ([33974](https://github.com/WordPress/gutenberg/pull/33974))
- Do not add to the block-library CSS bundle the colors that come from \`theme.json\`. ([33924](https://github.com/WordPress/gutenberg/pull/33924))
- Improve the rendering/update performance of the image block. ([33974](https://github.com/WordPress/gutenberg/pull/33974))

#### Block Editor
- Lazy render the inserter search results. ([33868](https://github.com/WordPress/gutenberg/pull/33868))
- Lazy render block types in the inserter. ([33749](https://github.com/WordPress/gutenberg/pull/33749))
- Lazy render the inserter search results. ([33868](https://github.com/WordPress/gutenberg/pull/33868))

#### Parsing
- Improve the performance of the parser by removing the automatic custom classnames handling. ([33903](https://github.com/WordPress/gutenberg/pull/33903))
Expand All @@ -117,8 +117,8 @@ exports[`formatChangelog verify that the changelog is properly formatted 1`] = `

#### Full Site Editing
- Site Editor: Implement a settings object filter. ([33737](https://github.com/WordPress/gutenberg/pull/33737))
- Template part selection popover - minor style updates for visiblity. ([33733](https://github.com/WordPress/gutenberg/pull/33733))
- Template Part placeholder - Add title step to creation flow. ([33703](https://github.com/WordPress/gutenberg/pull/33703))
- Template part selection popover - minor style updates for visiblity. ([33733](https://github.com/WordPress/gutenberg/pull/33733))

#### Block Library
- Enable ability to remove a link from the Nav Link block in the Nav Block. ([33777](https://github.com/WordPress/gutenberg/pull/33777))
Expand All @@ -128,15 +128,15 @@ exports[`formatChangelog verify that the changelog is properly formatted 1`] = `
### Documentation

- Add documentation to disable remote calls for block patterns. ([33930](https://github.com/WordPress/gutenberg/pull/33930))
- Docs: Add more details about block attributes. ([33880](https://github.com/WordPress/gutenberg/pull/33880))
- Add missing comma. ([33764](https://github.com/WordPress/gutenberg/pull/33764))
- Add spaces in add_theme_support documentation code. ([33796](https://github.com/WordPress/gutenberg/pull/33796))
- Correct spelling and grammar in documentation. ([33860](https://github.com/WordPress/gutenberg/pull/33860))
- Docs: Add more details about block attributes. ([33880](https://github.com/WordPress/gutenberg/pull/33880))
- Example for rest_endpoints filter in PHP. ([33738](https://github.com/WordPress/gutenberg/pull/33738))
- Fix gutenberg_resolve_template() return documentation. ([33800](https://github.com/WordPress/gutenberg/pull/33800))
- Add spaces in add_theme_support documentation code. ([33796](https://github.com/WordPress/gutenberg/pull/33796))
- Update documentation to reflect new automated process for feature grouping. ([33573](https://github.com/WordPress/gutenberg/pull/33573))
- [docs] fix: \`supports.color.gradients\` is plural. ([33781](https://github.com/WordPress/gutenberg/pull/33781))
- fix: Broken link in documentation to block support mechanism. ([33780](https://github.com/WordPress/gutenberg/pull/33780))
- Add missing comma. ([33764](https://github.com/WordPress/gutenberg/pull/33764))
- Example for rest_endpoints filter in PHP. ([33738](https://github.com/WordPress/gutenberg/pull/33738))
- Update documentation to reflect new automated process for feature grouping. ([33573](https://github.com/WordPress/gutenberg/pull/33573))
- link fix: Block editor Sidebar Tutorial. ([33308](https://github.com/WordPress/gutenberg/pull/33308))


Expand All @@ -145,29 +145,29 @@ exports[`formatChangelog verify that the changelog is properly formatted 1`] = `
- Scripts: Fix typo in format change message. ([33945](https://github.com/WordPress/gutenberg/pull/33945))

#### Components
- Components: Use the \`__unsafe_useEmotionCache\` in the \`useCx\` hook. ([33982](https://github.com/WordPress/gutenberg/pull/33982))
- Components utils: \`rtl()\` return type, \`rtl.watch()\` utility. ([33882](https://github.com/WordPress/gutenberg/pull/33882))
- components: InputControl to TypeScript. ([33696](https://github.com/WordPress/gutenberg/pull/33696))
- InputControl to TypeScript. ([33696](https://github.com/WordPress/gutenberg/pull/33696))
- Use the \`__unsafe_useEmotionCache\` in the \`useCx\` hook. ([33982](https://github.com/WordPress/gutenberg/pull/33982))

#### Block Library
- Site Logo: Use getMedia shorthand. ([33992](https://github.com/WordPress/gutenberg/pull/33992))
- Featured Image: Use getMedia shorthand. ([33943](https://github.com/WordPress/gutenberg/pull/33943))
- Site Logo: Use getMedia shorthand. ([33992](https://github.com/WordPress/gutenberg/pull/33992))

#### Global Styles
- Remove the experimental prefix and rename \`theme.json\` files. ([33925](https://github.com/WordPress/gutenberg/pull/33925))
- No longer read from \`experimental-theme.json\`. ([33904](https://github.com/WordPress/gutenberg/pull/33904))
- Remove the experimental prefix and rename \`theme.json\` files. ([33925](https://github.com/WordPress/gutenberg/pull/33925))

#### Plugin
- Plugin: Fix \`jsdoc/check-line-alignment\` ESLint warnings. ([33901](https://github.com/WordPress/gutenberg/pull/33901))
- Fix \`jsdoc/check-line-alignment\` ESLint warnings. ([33901](https://github.com/WordPress/gutenberg/pull/33901))

#### Post Editor
- Refactor MetaBoxesArea to to functional components using hooks. ([30542](https://github.com/WordPress/gutenberg/pull/30542))


### Tools

- GitHub Templates: Format bug report template. ([33786](https://github.com/WordPress/gutenberg/pull/33786))
- 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))
- Update bug issue template to use forms. ([33713](https://github.com/WordPress/gutenberg/pull/33713))

#### Testing
Expand All @@ -180,10 +180,10 @@ exports[`formatChangelog verify that the changelog is properly formatted 1`] = `

### Various

- Tune appender margin. ([33866](https://github.com/WordPress/gutenberg/pull/33866))
- RNMobile: Add integration test guide. ([33833](https://github.com/WordPress/gutenberg/pull/33833))
- Core Data: Deprecate \`getAuthors\` in favor of \`getUsers\`. ([33725](https://github.com/WordPress/gutenberg/pull/33725))
- RNMobile: Add integration test guide. ([33833](https://github.com/WordPress/gutenberg/pull/33833))
- RNMobile: Try unifying the unit test command on mobile. ([33657](https://github.com/WordPress/gutenberg/pull/33657))
- Tune appender margin. ([33866](https://github.com/WordPress/gutenberg/pull/33866))

#### Block Library
- Search Block: Removed components class from icon button and polished css. ([33961](https://github.com/WordPress/gutenberg/pull/33961))
Expand Down