Skip to content

Commit fe46290

Browse files
devversionmmalerba
authored andcommitted
build: changelog script not filtering duplicate entries (#14421)
1 parent e1487df commit fe46290

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/release/changelog.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {green, grey} from 'chalk';
1+
import {bold, green, yellow} from 'chalk';
22
import {createReadStream, createWriteStream, readFileSync} from 'fs';
33
import {prompt} from 'inquirer';
44
import {join} from 'path';
@@ -63,7 +63,8 @@ export async function promptChangelogReleaseName(): Promise<string> {
6363
* and has been cherry-picked into "master". In that case, the changelog will already contain
6464
* commits from master which might be added to the changelog again. This is because usually
6565
* patch and minor releases are tagged from the publish branches and therefore
66-
* conventional-changelog tries to build the changelog from last major version to master's HEAD.
66+
* conventional-changelog tries to build the changelog from last major version to master's
67+
* HEAD when a new major version is being published from the "master" branch.
6768
*/
6869
function createDedupeWriterOptions(changelogPath: string) {
6970
const existingChangelogContent = readFileSync(changelogPath, 'utf8');
@@ -76,8 +77,8 @@ function createDedupeWriterOptions(changelogPath: string) {
7677
group.commits = group.commits.filter((commit: any) => {
7778
// NOTE: We cannot compare the SHA's because the commits will have a different SHA
7879
// if they are being cherry-picked into a different branch.
79-
if (existingChangelogContent.includes(commit.header)) {
80-
console.log(grey(`Excluding: "${commit.header}" (${commit.hash})`));
80+
if (existingChangelogContent.includes(commit.subject)) {
81+
console.log(yellow(` ↺ Skipping duplicate: "${bold(commit.header)}"`));
8182
return false;
8283
}
8384
return true;

0 commit comments

Comments
 (0)