Skip to content

Commit a25e838

Browse files
committed
fix(core): use unified release body from root CHANGELOG.md in fixed mode
Fixed mode writes a single root CHANGELOG.md, but buildFixedReleaseBody() was iterating per-package and creating duplicate sections or falling back to per-package commit logs. Simplify to delegate to buildReleaseBody() without pkgPath, which naturally reads the root CHANGELOG and produces a unified commit list as fallback.
1 parent 94f4300 commit a25e838

File tree

2 files changed

+239
-173
lines changed

2 files changed

+239
-173
lines changed

packages/core/src/tasks/release-notes.ts

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -113,28 +113,19 @@ export async function buildFixedReleaseBody(
113113
): Promise<string> {
114114
const { packages, tag, repositoryUrl } = options;
115115

116-
// Resolve previousTag once and pass it down to avoid redundant git calls per package
117-
const git = new Git();
118-
const previousTag = (await git.previousTag(tag)) || (await git.firstCommit());
119-
120-
const compareLink = `**Full Changelog**: ${repositoryUrl}/compare/${previousTag}...${tag}`;
121-
122-
const sections: string[] = [];
123-
for (const pkg of packages) {
124-
const body = await buildReleaseBody(ctx, {
125-
pkgPath: pkg.pkgPath,
126-
version: pkg.version,
127-
tag,
128-
repositoryUrl,
129-
appendCompareLink: false,
130-
previousTag,
131-
});
132-
133-
sections.push(`## ${pkg.pkgName} v${pkg.version}\n\n${body}`);
134-
}
135-
136-
const joined = sections.join("\n\n---\n\n");
137-
return `${joined}\n\n${compareLink}`;
116+
// In fixed mode all packages share the same version (enforced by FixedVersionPlan).
117+
// Use the first entry; the type allows heterogeneous versions but fixed mode never produces them.
118+
const version = packages[0]?.version ?? tag.replace(/^v/, "");
119+
120+
// Delegate to buildReleaseBody WITHOUT pkgPath for unified body.
121+
// This reads root CHANGELOG.md (since pkgPath is undefined),
122+
// and falls back to unified commit list — matching how fixed mode
123+
// writes a single root CHANGELOG.md.
124+
return buildReleaseBody(ctx, {
125+
version,
126+
tag,
127+
repositoryUrl,
128+
});
138129
}
139130

140131
function extractChangelog(

0 commit comments

Comments
 (0)