From a32eaad423188c4475feb986d3d2ca0e2a9c33c9 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hack/tools/release/notes/process.go b/hack/tools/release/notes/process.go index 9bcd256bb4d5..013782e1b89f 100644 --- a/hack/tools/release/notes/process.go +++ b/hack/tools/release/notes/process.go @@ -200,11 +200,31 @@ 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_AREAS[]" substrings and multiple colons(:). +func updateTitle(input string) string { + // Remove "MULTIPLE_AREAS[" from the input + input = strings.Replace(input, "MULTIPLE_AREAS[", "", 1) + input = strings.Replace(input, "]", "", 1) + + // 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