Skip to content

Commit

Permalink
build: changelog script not filtering duplicate entries (#14421)
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion authored and mmalerba committed Dec 7, 2018
1 parent e1487df commit fe46290
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit fe46290

Please sign in to comment.