Skip to content
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
20 changes: 18 additions & 2 deletions pkg/notes/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import (

// Document represents the underlying structure of a release notes document.
type Document struct {
Kinds map[string][]string `json:"kinds"`
Uncategorized []string `json:"uncategorized"`
ActionRequired []string `json:"action_required"`
Kinds map[string][]string `json:"kinds"`
Uncategorized []string `json:"uncategorized"`
}

const (
Expand Down Expand Up @@ -85,6 +86,8 @@ func CreateDocument(notes ReleaseNotes, history ReleaseNotesHistory) (*Document,
} else {
doc.Kinds[kind] = []string{note.Markdown}
}
} else if note.ActionRequired {
doc.ActionRequired = append(doc.ActionRequired, note.Markdown)
} else {
for _, kind := range note.Kinds {
mappedKind := mapKind(kind)
Expand All @@ -102,6 +105,7 @@ func CreateDocument(notes ReleaseNotes, history ReleaseNotesHistory) (*Document,
}
}
}
sort.Strings(doc.ActionRequired)
return doc, nil
}

Expand Down Expand Up @@ -132,6 +136,18 @@ func RenderMarkdown(doc *Document, bucket, tars, prevTag, newTag string) (string
nl()
}

// notes with action required get their own section
if len(doc.ActionRequired) > 0 {
o.WriteString("## Urgent Upgrade Notes")
nlnl()
o.WriteString("### (No, really, you MUST read this before you upgrade)")
nlnl()
for _, note := range doc.ActionRequired {
writeNote(note)
nl()
}
}

// each Kind gets a section
sortedKinds := sortKinds(doc.Kinds)
if len(sortedKinds) > 0 {
Expand Down