Skip to content

Commit

Permalink
Automated changelog: remove Uncategorized header in output and plac…
Browse files Browse the repository at this point in the history
…e items at top (#34037)

* Remove "Uncategorized" header in output and place items at top

* Tweak comment

* Make compatible with changes to use headings instead of bullets
  • Loading branch information
getdave authored Aug 12, 2021
1 parent 99ef4c3 commit e65a777
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,10 @@ async function getChangelog( settings ) {

// Avoids double nesting such as "Documentation" feature under
// the "Documentation" section.
if ( group !== featureName ) {
if (
group !== featureName &&
featureName !== UNKNOWN_FEATURE_FALLBACK_NAME
) {
// Start new <ul> for the Feature group.
changelog += '#### ' + featureName + '\n';
}
Expand Down Expand Up @@ -709,11 +712,11 @@ async function getChangelog( settings ) {
function sortFeatureGroups( featureGroups ) {
return Object.keys( featureGroups ).sort(
( featureAName, featureBName ) => {
// Sort "Unknown" to always be at the end
// Sort "uncategorized" items to *always* be at the top of the section
if ( featureAName === UNKNOWN_FEATURE_FALLBACK_NAME ) {
return 1;
} else if ( featureBName === UNKNOWN_FEATURE_FALLBACK_NAME ) {
return -1;
} else if ( featureBName === UNKNOWN_FEATURE_FALLBACK_NAME ) {
return 1;
}

// Sort by greatest number of PRs in the group first.
Expand Down

0 comments on commit e65a777

Please sign in to comment.