@@ -82,6 +82,11 @@ function section(areas: Set<string>) { |
82 | 82 | return "Core" |
83 | 83 | } |
84 | 84 |
|
| 85 | +function type(message: string) { |
| 86 | + if (message.match(/fix/i)) return "Bugfixes" |
| 87 | + return "Improvements" |
| 88 | +} |
| 89 | + |
85 | 90 | function reverted(commits: Commit[]) { |
86 | 91 | const seen = new Map<string, Commit>() |
87 | 92 |
|
@@ -193,13 +198,20 @@ async function thanks(from: string, to: string, reuse: boolean) { |
193 | 198 | } |
194 | 199 |
|
195 | 200 | function format(from: string, to: string, list: Commit[], thanks: string[]) { |
196 | | - const grouped = new Map<string, string[]>() |
197 | | - for (const title of order) grouped.set(title, []) |
| 201 | + const grouped = new Map<string, Map<string, string[]>>() |
| 202 | + for (const title of order) { |
| 203 | + grouped.set( |
| 204 | + title, |
| 205 | + new Map([ |
| 206 | + ["Improvements", []], |
| 207 | + ["Bugfixes", []], |
| 208 | + ]), |
| 209 | + ) |
| 210 | + } |
198 | 211 |
|
199 | 212 | for (const commit of list) { |
200 | | - const title = section(commit.areas) |
201 | 213 | const attr = commit.author && !team.includes(commit.author) ? ` (@${commit.author})` : "" |
202 | | - grouped.get(title)!.push(`- \`${commit.hash}\` ${commit.message}${attr}`) |
| 214 | + grouped.get(section(commit.areas))!.get(type(commit.message))!.push(`- \`${commit.hash}\` ${commit.message}${attr}`) |
203 | 215 | } |
204 | 216 |
|
205 | 217 | const lines = [`Last release: ${ref(from)}`, `Target ref: ${to}`, ""] |
@@ -209,11 +221,23 @@ function format(from: string, to: string, list: Commit[], thanks: string[]) { |
209 | 221 | } |
210 | 222 |
|
211 | 223 | for (const title of order) { |
212 | | - const entries = grouped.get(title) |
213 | | - if (!entries || entries.length === 0) continue |
| 224 | + const groups = grouped.get(title) |
| 225 | + if (!groups || [...groups.values()].every((entries) => entries.length === 0)) continue |
214 | 226 | lines.push(`## ${title}`) |
215 | | - lines.push(...entries) |
216 | | - lines.push("") |
| 227 | + const improvements = groups.get("Improvements")! |
| 228 | + const bugfixes = groups.get("Bugfixes")! |
| 229 | + if (bugfixes.length === 0) { |
| 230 | + lines.push(...improvements) |
| 231 | + lines.push("") |
| 232 | + continue |
| 233 | + } |
| 234 | + |
| 235 | + for (const [subtitle, entries] of groups) { |
| 236 | + if (entries.length === 0) continue |
| 237 | + lines.push(`### ${subtitle}`) |
| 238 | + lines.push(...entries) |
| 239 | + lines.push("") |
| 240 | + } |
217 | 241 | } |
218 | 242 |
|
219 | 243 | if (thanks.length > 0) { |
|