From eecc038d0bd4c062b8bb63d42380d699b220273b Mon Sep 17 00:00:00 2001 From: chandankumar4 Date: Sun, 7 Sep 2025 00:19:09 +0530 Subject: [PATCH] feat: Update release notes tool to handle multiples_areas and colons Signed-off-by: chandankumar4 --- hack/tools/release/notes/process.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) 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, "/") } }