Skip to content

Commit 45ebe51

Browse files
authored
internal/generator: Update markdown formatting (#8)
Signed-off-by: timflannagan <[email protected]>
1 parent c9d3c5c commit 45ebe51

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

internal/generator/generator.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ var releaseNoteRE = regexp.MustCompile("(?s)```release-note\\s*(.*?)\\s*```")
1515

1616
// Supported kinds for bucket headers
1717
var kindHeaders = map[string]string{
18-
"new_feature": "🚀 Features",
19-
"bug_fix": "🐛 Bug Fixes",
20-
"breaking_change": "💥 Breaking Changes",
21-
"documentation": "📝 Documentation",
22-
"performance": " Performance Improvements",
18+
"new_feature": "## Features",
19+
"bug_fix": "## Bug Fixes",
20+
"breaking_change": "## Breaking Changes",
21+
"documentation": "## Documentation",
22+
"performance": "## Performance Improvements",
2323
}
2424

2525
// Generator handles changelog generation for a repository
@@ -119,13 +119,14 @@ func (g *Generator) generateChangelog(prs []*github.PullRequest) string {
119119
sort.Strings(kinds)
120120

121121
// build the changelog
122+
changelog.WriteString("# Changelog\n")
122123
for _, kind := range kinds {
123124
header := kindHeaders[kind]
124125
prs := buckets[kind]
125126
if len(prs) == 0 {
126127
continue
127128
}
128-
changelog.WriteString(fmt.Sprintf("\n## %s\n\n", header))
129+
changelog.WriteString(fmt.Sprintf("\n%s\n\n", header))
129130
for _, pr := range prs {
130131
body := pr.GetBody()
131132
if body == "" {

internal/generator/generator_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ func TestGenerateChangelog(t *testing.T) {
5151
}},
5252
}},
5353
expectedChangelog: `
54-
## 🚀 Features
54+
# Changelog
55+
56+
## Features
5557
5658
- My note for PR42 (#42)
5759
`,
@@ -76,8 +78,10 @@ func TestGenerateChangelog(t *testing.T) {
7678
Name: github.Ptr("irrelevant-label"),
7779
}},
7880
}},
79-
expectedChangelog: "",
80-
expectError: false,
81+
expectedChangelog: `
82+
# Changelog
83+
`,
84+
expectError: false,
8185
},
8286
{
8387
name: "Valid/Multiple PRs with different kinds",
@@ -119,15 +123,17 @@ func TestGenerateChangelog(t *testing.T) {
119123
},
120124
},
121125
expectedChangelog: `
122-
## 💥 Breaking Changes
126+
# Changelog
127+
128+
## Breaking Changes
123129
124130
- Removed old feature (#44)
125131
126-
## 🐛 Bug Fixes
132+
## Bug Fixes
127133
128134
- Fixed a bug (#43)
129135
130-
## 🚀 Features
136+
## Features
131137
132138
- Implement new feature (#42)
133139
`,

0 commit comments

Comments
 (0)