Skip to content

Commit b45b000

Browse files
authored
Blank lines around headings in generated release notes (#1201)
1 parent 2c84173 commit b45b000

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

make_release/notes/create-pr.nu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ by opening PRs against the `release-notes-($version)` branch.
5252
- [ ] add the full changelog
5353
- [ ] categorize each PR
5454
- [ ] write all the sections and complete all the `TODO`s
55+
5556
[deprecations]: https://github.com/nushell/nushell/labels/deprecation
5657
[removals]: https://github.com/nushell/nushell/pulls?q=is%3Apr+is%3Aopen+label%3Aremoval-after-deprecation"
5758

make_release/notes/generate.nu

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export def get-release-notes []: record -> record {
7777
# Add PR title as default heading for multi-line summaries
7878
if $lines > 1 and not ($notes starts-with "###") {
7979
$pr = $pr | add-notice info "multi-line summaries with no explicit title (using PR title as heading title)"
80-
$notes = "### " + ($pr.title | clean-title) ++ (char nl) ++ $notes
80+
$notes = "### " + ($pr.title | clean-title) ++ (char nl) ++ (char nl) ++ $notes
8181
}
8282

8383
# Check for suspiciously short release notes section
@@ -145,18 +145,24 @@ export def generate-section []: record<section: string, prs: table> -> string {
145145
let bullet = $prs | where ($it.notes | lines | length) == 1
146146

147147
# Add header
148-
$body ++= [$"## ($section.h2)"]
148+
$body ++= [$"## ($section.h2)\n"]
149149

150150
# Add multi-line summaries
151-
$body ++= $multiline.notes
151+
for note in $multiline.notes {
152+
if ($note | str ends-with "\n") {
153+
$body ++= [$note]
154+
} else {
155+
$body ++= [($note ++ (char nl))]
156+
}
157+
}
152158

153159
# Add single-line summaries
154160
if ($multiline | is-not-empty) {
155-
$body ++= [$"### ($section.h3)"]
161+
$body ++= [$"### ($section.h3)\n"]
156162
}
157163
$body ++= $bullet | each {|pr| "* " ++ $pr.notes ++ $" \(($pr | pr-link)\)" }
158164

159-
$body | str join (char nl)
165+
($body | str join (char nl)) ++ (char nl)
160166
}
161167

162168
# Generate the "Hall of Fame" section of the release notes.

0 commit comments

Comments
 (0)