Skip to content

build: changelog script not filtering duplicate entries #14421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tools/release/changelog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {green, grey} from 'chalk';
import {bold, green, yellow} from 'chalk';
import {createReadStream, createWriteStream, readFileSync} from 'fs';
import {prompt} from 'inquirer';
import {join} from 'path';
Expand Down Expand Up @@ -63,7 +63,8 @@ export async function promptChangelogReleaseName(): Promise<string> {
* and has been cherry-picked into "master". In that case, the changelog will already contain
* commits from master which might be added to the changelog again. This is because usually
* patch and minor releases are tagged from the publish branches and therefore
* conventional-changelog tries to build the changelog from last major version to master's HEAD.
* conventional-changelog tries to build the changelog from last major version to master's
* HEAD when a new major version is being published from the "master" branch.
*/
function createDedupeWriterOptions(changelogPath: string) {
const existingChangelogContent = readFileSync(changelogPath, 'utf8');
Expand All @@ -76,8 +77,8 @@ function createDedupeWriterOptions(changelogPath: string) {
group.commits = group.commits.filter((commit: any) => {
// NOTE: We cannot compare the SHA's because the commits will have a different SHA
// if they are being cherry-picked into a different branch.
if (existingChangelogContent.includes(commit.header)) {
console.log(grey(`Excluding: "${commit.header}" (${commit.hash})`));
if (existingChangelogContent.includes(commit.subject)) {
console.log(yellow(` ↺ Skipping duplicate: "${bold(commit.header)}"`));
return false;
}
return true;
Expand Down