Repository: knope-dev/knope (rust)
Issue: Move GitHub release headers up a level
The overall changelog format looks like

# Title of changelog

## 1.0.0

### Breaking changes

#### specific change note here

However, in a GitHub release, each release section is totally independent. The top-level single-hash header is the version number, which makes changes look, effectively, like this:

# 1.0.0

### Breaking changes

#### specific change note here

What a waste of header levels! We could make this a bit smarter by reducing the header level of every line included in the body, like:

# 1.0.0

## Breaking changes

### specific change note here

Which, conveniently, will make the rendered content of each change much nicer (as 4th-level headers look like plain ol' bold text.
Pull request description: feat: Move GitHub Release headers up a level (#467)
Closes #467

Patch:
diff --git a/src/releases/github.rs b/src/releases/github.rs
index 2ed287e..71cd8a1 100644
--- a/src/releases/github.rs
+++ b/src/releases/github.rs
@@ -28,10 +28,24 @@ pub(crate) fn release(
         release_title
     };
 
+    let body = release
+        .new_changelog
+        .lines()
+        .map(|line| {
+            if line.starts_with("##") {
+                #[allow(clippy::indexing_slicing)] // Just checked len above
+                &line[1..] // Reduce header level by one
+            } else {
+                line
+            }
+        })
+        .collect::<Vec<_>>()
+        .join("\n");
+
     let github_release = GitHubRelease {
         tag_name: &tag_name,
         name: &name,
-        body: &release.new_changelog,
+        body,
         prerelease: version.is_prerelease(),
     };
 
@@ -76,6 +90,6 @@ pub(crate) fn release(
 struct GitHubRelease<'a> {
     tag_name: &'a str,
     name: &'a str,
-    body: &'a str,
+    body: String,
     prerelease: bool,
 }


Test patch:
diff --git a/tests/git_release.rs b/tests/git_release.rs
index 26393ca..198a2de 100644
--- a/tests/git_release.rs
+++ b/tests/git_release.rs
@@ -43,9 +43,11 @@ fn git_release() {
     // Assert.
     dry_run_assert
         .success()
+        .with_assert(assert())
         .stdout_matches_path(source_path.join("dry_run_output.txt"));
     actual_assert
         .success()
+        .with_assert(assert())
         .stdout_matches_path(source_path.join("output.txt"));
     assert().matches_path(
         source_path.join("EXPECTED_CHANGELOG.md"),
diff --git a/tests/git_release/EXPECTED_CHANGELOG.md b/tests/git_release/EXPECTED_CHANGELOG.md
index 5ab87e4..4ae523c 100644
--- a/tests/git_release/EXPECTED_CHANGELOG.md
+++ b/tests/git_release/EXPECTED_CHANGELOG.md
@@ -1,4 +1,4 @@
-## 1.1.0 (2023-06-18)
+## 1.1.0 ([DATE])
 
 ### Features
 
diff --git a/tests/git_release/dry_run_output.txt b/tests/git_release/dry_run_output.txt
index f8be6ac..399464b 100644
--- a/tests/git_release/dry_run_output.txt
+++ b/tests/git_release/dry_run_output.txt
@@ -1,6 +1,6 @@
 Would bump Cargo.toml to 1.1.0
 Would add the following to CHANGELOG.md:
-## 1.1.0 (2023-06-18)
+## 1.1.0 ([DATE])
 
 ### Features
 
diff --git a/tests/github_release/dry_run_output.txt b/tests/github_release/dry_run_output.txt
index 3d477a9..76ed9fc 100644
--- a/tests/github_release/dry_run_output.txt
+++ b/tests/github_release/dry_run_output.txt
@@ -10,7 +10,6 @@ Would add files to git:
   Cargo.toml
   CHANGELOG.md
 Would create a release on GitHub with name 1.1.0 ([DATE]) and tag v1.1.0 and body:
-### Features
-
-#### New feature
+## Features
 
+### New feature
diff --git a/tests/github_release/multiple_packages/dry_run_output.txt b/tests/github_release/multiple_packages/dry_run_output.txt
index d93bbd0..717e99b 100644
--- a/tests/github_release/multiple_packages/dry_run_output.txt
+++ b/tests/github_release/multiple_packages/dry_run_output.txt
@@ -23,12 +23,10 @@ Would add files to git:
   package.json
   SECOND_CHANGELOG.md
 Would create a release on GitHub with name first 2.0.0 ([DATE]) and tag first/v2.0.0 and body:
-### Breaking Changes
-
-#### New breaking feature
+## Breaking Changes
 
+### New breaking feature
 Would create a release on GitHub with name second 0.5.0 ([DATE]) and tag second/v0.5.0 and body:
-### Breaking Changes
-
-#### New breaking feature
+## Breaking Changes
 
+### New breaking feature
diff --git a/tests/no_config/github/stdout.txt b/tests/no_config/github/stdout.txt
index 9d1ad96..be38cbd 100644
--- a/tests/no_config/github/stdout.txt
+++ b/tests/no_config/github/stdout.txt
@@ -3,7 +3,6 @@ Would add files to git:
   Cargo.toml
 Would run git commit -m "chore: prepare release 2.0.0" && git push
 Would create a release on GitHub with name 2.0.0 ([DATE]) and tag v2.0.0 and body:
-### Breaking Changes
-
-#### Breaking Change
+## Breaking Changes
 
+### Breaking Change