Skip to content

Commit a32eaad

Browse files
committed
feat: Update release notes tool to handle multiples_areas and colons
Signed-off-by: chandankumar4 <[email protected]>
1 parent eb4e38c commit a32eaad

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

hack/tools/release/notes/process.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,31 @@ func (g prEntriesProcessor) generateNoteEntry(p *pr) *notesEntry {
200200
}
201201

202202
entry.prNumber = fmt.Sprintf("%d", p.number)
203+
entry.title = updateTitle(entry.title)
203204
entry.title = formatPREntry(entry.title, entry.prNumber)
204205

205206
return entry
206207
}
207208

209+
// UpdateTitle updates a title by removing the "MULTIPLE_AREAS[]" substrings and multiple colons(:).
210+
func updateTitle(input string) string {
211+
// Remove "MULTIPLE_AREAS[" from the input
212+
input = strings.Replace(input, "MULTIPLE_AREAS[", "", 1)
213+
input = strings.Replace(input, "]", "", 1)
214+
215+
// Remove the extra colons from the title
216+
colonCount := strings.Count(input, ":")
217+
if colonCount == 2 {
218+
// Find the position of the first colon
219+
firstColonIndex := strings.Index(input, ":")
220+
// Extract the part after the first colon and remove any leading spaces
221+
partAfterColon := strings.TrimSpace(input[firstColonIndex+1:])
222+
// Replace the first colon with "/"
223+
input = input[:firstColonIndex] + "/" + partAfterColon
224+
}
225+
return input
226+
}
227+
208228
// extractArea processes the PR labels to extract the area.
209229
func (g prEntriesProcessor) extractArea(pr *pr) string {
210230
var areaLabels []string

0 commit comments

Comments
 (0)