diff options
| author | Shoubhit Dash <[email protected]> | 2026-05-03 19:18:26 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-05-03 13:48:26 +0000 |
| commit | 0a7d02c87cea5092f34aafba846d136870ac27bc (patch) | |
| tree | 56e193637a164c11c5d857dcca0d278125f57374 /script | |
| parent | e77867ef058f2e0fde159c5d6fb6b2e575f9f7a7 (diff) | |
| download | opencode-0a7d02c87cea5092f34aafba846d136870ac27bc.tar.gz opencode-0a7d02c87cea5092f34aafba846d136870ac27bc.zip | |
feat: group changelog bugfixes (#25597)
Diffstat (limited to 'script')
| -rw-r--r-- | script/raw-changelog.ts | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/script/raw-changelog.ts b/script/raw-changelog.ts index 735b078be..c571de322 100644 --- a/script/raw-changelog.ts +++ b/script/raw-changelog.ts @@ -82,6 +82,11 @@ function section(areas: Set<string>) { return "Core" } +function type(message: string) { + if (message.match(/fix/i)) return "Bugfixes" + return "Improvements" +} + function reverted(commits: Commit[]) { const seen = new Map<string, Commit>() @@ -193,13 +198,20 @@ async function thanks(from: string, to: string, reuse: boolean) { } function format(from: string, to: string, list: Commit[], thanks: string[]) { - const grouped = new Map<string, string[]>() - for (const title of order) grouped.set(title, []) + const grouped = new Map<string, Map<string, string[]>>() + for (const title of order) { + grouped.set( + title, + new Map([ + ["Improvements", []], + ["Bugfixes", []], + ]), + ) + } for (const commit of list) { - const title = section(commit.areas) const attr = commit.author && !team.includes(commit.author) ? ` (@${commit.author})` : "" - grouped.get(title)!.push(`- \`${commit.hash}\` ${commit.message}${attr}`) + grouped.get(section(commit.areas))!.get(type(commit.message))!.push(`- \`${commit.hash}\` ${commit.message}${attr}`) } const lines = [`Last release: ${ref(from)}`, `Target ref: ${to}`, ""] @@ -209,11 +221,23 @@ function format(from: string, to: string, list: Commit[], thanks: string[]) { } for (const title of order) { - const entries = grouped.get(title) - if (!entries || entries.length === 0) continue + const groups = grouped.get(title) + if (!groups || [...groups.values()].every((entries) => entries.length === 0)) continue lines.push(`## ${title}`) - lines.push(...entries) - lines.push("") + const improvements = groups.get("Improvements")! + const bugfixes = groups.get("Bugfixes")! + if (bugfixes.length === 0) { + lines.push(...improvements) + lines.push("") + continue + } + + for (const [subtitle, entries] of groups) { + if (entries.length === 0) continue + lines.push(`### ${subtitle}`) + lines.push(...entries) + lines.push("") + } } if (thanks.length > 0) { |
