Skip to content

Commit 8adeac1

Browse files
committed
fix(conventional-commits): Avoid duplicate root changelog entries with custom --tag-version-prefix
Fixes #2197
1 parent effa054 commit 8adeac1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

core/conventional-commits/__tests__/conventional-commits.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ describe("conventional-commits", () => {
385385
* A second commit for our CHANGELOG ([SHA](https://github.com/lerna/conventional-commits-fixed/commit/SHA))
386386
`);
387387
expect(rootChangelog.newEntry.trimRight()).toMatchInlineSnapshot(`
388-
## 1.0.1 (YYYY-MM-DD)
388+
## [1.0.1](/compare/dragons-are-awesome1.0.0...1.0.1) (YYYY-MM-DD)
389389
390390
391391
### Bug Fixes
@@ -409,12 +409,11 @@ describe("conventional-commits", () => {
409409

410410
// second commit should not show up again
411411
expect(lastRootChangelog.newEntry.trimRight()).toMatchInlineSnapshot(`
412-
## 1.0.2 (YYYY-MM-DD)
412+
## [1.0.2](/compare/dragons-are-awesome1.0.1...1.0.2) (YYYY-MM-DD)
413413
414414
415415
### Bug Fixes
416416
417-
* A second commit for our CHANGELOG ([SHA](https://github.com/lerna/conventional-commits-fixed/commit/SHA))
418417
* A third commit for our CHANGELOG ([SHA](https://github.com/lerna/conventional-commits-fixed/commit/SHA))
419418
`);
420419
});

core/conventional-commits/lib/update-changelog.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function updateChangelog(pkg, type, { changelogPreset, rootPath, tagPrefix, vers
3232

3333
if (type === "root") {
3434
context = { version };
35+
36+
// root changelogs are only enabled in fixed mode, and need the proper tag prefix
37+
options.tagPrefix = tagPrefix;
3538
} else {
3639
// "fixed" or "independent"
3740
gitRawCommitsOpts.path = pkg.location;

0 commit comments

Comments
 (0)