Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions hack/tools/release/notes/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(:).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: When does the "multiple colon" case happen?

func updateTitle(input string) string {
// Remove "MULTIPLE_AREAS[" from the input
input = strings.Replace(input, "MULTIPLE_AREAS[", "", 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about simply not adding MULTIPLE_AREAS wherever we do that, so that we don't have to remove it here again?

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
Expand Down
Loading