diff --git a/hack/tools/release/notes/process.go b/hack/tools/release/notes/process.go index 9bcd256bb4d5..7883e730a846 100644 --- a/hack/tools/release/notes/process.go +++ b/hack/tools/release/notes/process.go @@ -31,10 +31,9 @@ import ( ) const ( - missingAreaLabelPrefix = "MISSING_AREA" - areaLabelPrefix = "area/" - multipleAreaLabelsPrefix = "MULTIPLE_AREAS[" - documentationArea = "Documentation" + missingAreaLabelPrefix = "MISSING_AREA" + areaLabelPrefix = "area/" + documentationArea = "Documentation" ) var ( @@ -200,11 +199,27 @@ func (g prEntriesProcessor) generateNoteEntry(p *pr) *notesEntry { } entry.prNumber = fmt.Sprintf("%d", p.number) + entry.title = updateTitle(entry.title) entry.title = formatPREntry(entry.title, entry.prNumber) return entry } +// UpdateTitle updates a title by removing the multiple colons(:). +func updateTitle(input string) string { + // Remove the extra colons from the title + colonCount := strings.Count(input, ":") + if colonCount == 2 { + // Find the position of the first colon + firstColonIndex := strings.Index(input, ":") + // Extract the part after the first colon and remove any leading spaces + partAfterColon := strings.TrimSpace(input[firstColonIndex+1:]) + // Replace the first colon with "/" + input = input[:firstColonIndex] + "/" + partAfterColon + } + return input +} + // extractArea processes the PR labels to extract the area. func (g prEntriesProcessor) extractArea(pr *pr) string { var areaLabels []string @@ -226,7 +241,7 @@ func (g prEntriesProcessor) extractArea(pr *pr) string { case 1: return areaLabels[0] default: - return multipleAreaLabelsPrefix + strings.Join(areaLabels, "/") + "]" + return strings.Join(areaLabels, "/") } }