@@ -352,6 +352,7 @@ func run() int {
352
352
353
353
switch key {
354
354
case documentation :
355
+ sort .Strings (mergeslice )
355
356
if len (mergeslice ) == 1 {
356
357
fmt .Printf (
357
358
":book: Additionally, there has been 1 contribution to our documentation and book. (%s) \n \n " ,
@@ -435,14 +436,14 @@ type releaseNoteEntry struct {
435
436
prNumber string
436
437
}
437
438
438
- // modifyEntryTitle removes the specified prefixes from the title.
439
- func modifyEntryTitle (title string , prefixes []string ) string {
439
+ // removePrefixes removes the specified prefixes from the title.
440
+ func removePrefixes (title string , prefixes []string ) string {
440
441
entryWithoutTag := title
441
442
for _ , prefix := range prefixes {
442
443
entryWithoutTag = strings .TrimLeft (strings .TrimPrefix (entryWithoutTag , prefix ), " " )
443
444
}
444
445
445
- return strings . ToUpper ( string ( entryWithoutTag [ 0 ])) + entryWithoutTag [ 1 :]
446
+ return entryWithoutTag
446
447
}
447
448
448
449
// trimAreaFromTitle removes the prefixed area from title to avoid duplication.
@@ -455,6 +456,10 @@ func trimAreaFromTitle(title, area string) string {
455
456
return titleWithoutArea
456
457
}
457
458
459
+ func capitalize (str string ) string {
460
+ return strings .ToUpper (string (str [0 ])) + str [1 :]
461
+ }
462
+
458
463
// generateReleaseNoteEntry processes a commit into a PR line item for the release notes.
459
464
func generateReleaseNoteEntry (c * commit ) (* releaseNoteEntry , error ) {
460
465
entry := & releaseNoteEntry {}
@@ -476,22 +481,22 @@ func generateReleaseNoteEntry(c *commit) (*releaseNoteEntry, error) {
476
481
switch {
477
482
case strings .HasPrefix (entry .title , ":sparkles:" ), strings .HasPrefix (entry .title , "✨" ):
478
483
entry .section = features
479
- entry .title = modifyEntryTitle (entry .title , []string {":sparkles:" , "✨" })
484
+ entry .title = removePrefixes (entry .title , []string {":sparkles:" , "✨" })
480
485
case strings .HasPrefix (entry .title , ":bug:" ), strings .HasPrefix (entry .title , "🐛" ):
481
486
entry .section = bugs
482
- entry .title = modifyEntryTitle (entry .title , []string {":bug:" , "🐛" })
487
+ entry .title = removePrefixes (entry .title , []string {":bug:" , "🐛" })
483
488
case strings .HasPrefix (entry .title , ":book:" ), strings .HasPrefix (entry .title , "📖" ):
484
489
entry .section = documentation
485
- entry .title = modifyEntryTitle (entry .title , []string {":book:" , "📖" })
490
+ entry .title = removePrefixes (entry .title , []string {":book:" , "📖" })
486
491
if strings .Contains (entry .title , "CAEP" ) || strings .Contains (entry .title , "proposal" ) {
487
492
entry .section = proposals
488
493
}
489
494
case strings .HasPrefix (entry .title , ":seedling:" ), strings .HasPrefix (entry .title , "🌱" ):
490
495
entry .section = other
491
- entry .title = modifyEntryTitle (entry .title , []string {":seedling:" , "🌱" })
496
+ entry .title = removePrefixes (entry .title , []string {":seedling:" , "🌱" })
492
497
case strings .HasPrefix (entry .title , ":warning:" ), strings .HasPrefix (entry .title , "⚠️" ):
493
498
entry .section = warning
494
- entry .title = modifyEntryTitle (entry .title , []string {":warning:" , "⚠️" })
499
+ entry .title = removePrefixes (entry .title , []string {":warning:" , "⚠️" })
495
500
default :
496
501
entry .section = unknown
497
502
}
@@ -513,8 +518,10 @@ func generateReleaseNoteEntry(c *commit) (*releaseNoteEntry, error) {
513
518
514
519
if * prefixAreaLabel {
515
520
entry .title = trimAreaFromTitle (entry .title , area )
521
+ entry .title = capitalize (entry .title )
516
522
entry .title = fmt .Sprintf ("- %s: %s" , area , entry .title )
517
523
} else {
524
+ entry .title = capitalize (entry .title )
518
525
entry .title = fmt .Sprintf ("- %s" , entry .title )
519
526
}
520
527
0 commit comments