Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 capitalized title in release notes #9086

Merged
Merged
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
24 changes: 14 additions & 10 deletions hack/tools/release/notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,15 @@ type releaseNoteEntry struct {
prNumber string
}

func modifyEntryTitle(title string, prefixes []string) string {
entryWithoutTag := title
for _, prefix := range prefixes {
entryWithoutTag = strings.TrimLeft(strings.TrimPrefix(entryWithoutTag, prefix), " ")
}

return strings.ToUpper(string(entryWithoutTag[0])) + entryWithoutTag[1:]
}

// generateReleaseNoteEntry processes a commit into a PR line item for the release notes.
func generateReleaseNoteEntry(c *commit) (*releaseNoteEntry, error) {
entry := &releaseNoteEntry{}
Expand All @@ -452,27 +461,22 @@ func generateReleaseNoteEntry(c *commit) (*releaseNoteEntry, error) {
switch {
case strings.HasPrefix(entry.title, ":sparkles:"), strings.HasPrefix(entry.title, "✨"):
entry.section = features
entry.title = strings.TrimPrefix(entry.title, ":sparkles:")
entry.title = strings.TrimPrefix(entry.title, "✨")
entry.title = modifyEntryTitle(entry.title, []string{":sparkles:", "✨"})
case strings.HasPrefix(entry.title, ":bug:"), strings.HasPrefix(entry.title, "🐛"):
entry.section = bugs
entry.title = strings.TrimPrefix(entry.title, ":bug:")
entry.title = strings.TrimPrefix(entry.title, "🐛")
entry.title = modifyEntryTitle(entry.title, []string{":bug:", "🐛"})
case strings.HasPrefix(entry.title, ":book:"), strings.HasPrefix(entry.title, "📖"):
entry.section = documentation
entry.title = strings.TrimPrefix(entry.title, ":book:")
entry.title = strings.TrimPrefix(entry.title, "📖")
entry.title = modifyEntryTitle(entry.title, []string{":book:", "📖"})
if strings.Contains(entry.title, "CAEP") || strings.Contains(entry.title, "proposal") {
entry.section = proposals
}
case strings.HasPrefix(entry.title, ":seedling:"), strings.HasPrefix(entry.title, "🌱"):
entry.section = other
entry.title = strings.TrimPrefix(entry.title, ":seedling:")
entry.title = strings.TrimPrefix(entry.title, "🌱")
entry.title = modifyEntryTitle(entry.title, []string{":seedling:", "🌱"})
case strings.HasPrefix(entry.title, ":warning:"), strings.HasPrefix(entry.title, "⚠️"):
entry.section = warning
entry.title = strings.TrimPrefix(entry.title, ":warning:")
entry.title = strings.TrimPrefix(entry.title, "⚠️")
entry.title = modifyEntryTitle(entry.title, []string{":warning:", "⚠️"})
default:
entry.section = unknown
}
Expand Down