Skip to content

Commit 12bf619

Browse files
devversionjelbourn
authored andcommitted
build: filter out experimental changes from changelog (#14598)
* Based on request from Vivian and the comments on the last changelog PR, we don't want to report experimental package changes (yet). In order to make this easier for the caretaker when doing releases, we just filter these out automatically.
1 parent 27d3b02 commit 12bf619

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

tools/release/changelog.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function prependChangelogFromLatestTag(changelogPath: string, relea
2525
/* context options */ {title: releaseName},
2626
/* raw-commits options */ null,
2727
/* commit parser options */ null,
28-
/* writer options */ createDedupeWriterOptions(changelogPath));
28+
/* writer options */ createChangelogWriterOptions(changelogPath));
2929

3030
// Stream for reading the existing changelog. This is necessary because we want to
3131
// actually prepend the new changelog to the existing one.
@@ -57,15 +57,16 @@ export async function promptChangelogReleaseName(): Promise<string> {
5757
}
5858

5959
/**
60-
* Creates changelog writer options which ensure that commits are not showing up multiple times.
61-
* Commits can show up multiple times if a changelog has been generated on a publish branch
62-
* and has been cherry-picked into "master". In that case, the changelog will already contain
63-
* commits from master which might be added to the changelog again. This is because usually
64-
* patch and minor releases are tagged from the publish branches and therefore
65-
* conventional-changelog tries to build the changelog from last major version to master's
66-
* HEAD when a new major version is being published from the "master" branch.
60+
* Creates changelog writer options which ensure that commits which are duplicated, or for
61+
* experimental packages do not showing up multiple times. Commits can show up multiple times
62+
* if a changelog has been generated on a publish branch and has been cherry-picked into "master".
63+
* In that case, the changelog will already contain cherry-picked commits from master which might
64+
* be added to future changelog's on "master" again. This is because usually patch and minor
65+
* releases are tagged from the publish branches and therefore conventional-changelog tries to
66+
* build the changelog from last major version to master's HEAD when a new major version is being
67+
* published from the "master" branch.
6768
*/
68-
function createDedupeWriterOptions(changelogPath: string) {
69+
function createChangelogWriterOptions(changelogPath: string) {
6970
const existingChangelogContent = readFileSync(changelogPath, 'utf8');
7071

7172
return {
@@ -74,8 +75,16 @@ function createDedupeWriterOptions(changelogPath: string) {
7475
finalizeContext: (context: any) => {
7576
context.commitGroups = context.commitGroups.filter((group: any) => {
7677
group.commits = group.commits.filter((commit: any) => {
77-
// NOTE: We cannot compare the SHA's because the commits will have a different SHA
78-
// if they are being cherry-picked into a different branch.
78+
79+
// Commits that change things for "cdk-experimental" or "material-experimental" will also
80+
// show up in the changelog by default. We don't want to show these in the changelog.
81+
if (commit.scope && commit.scope.includes('experimental')) {
82+
console.log(yellow(` ↺ Skipping experimental: "${bold(commit.header)}"`));
83+
return false;
84+
}
85+
86+
// Filter out duplicate commits. Note that we cannot compare the SHA because the commits
87+
// will have a different SHA if they are being cherry-picked into a different branch.
7988
if (existingChangelogContent.includes(commit.subject)) {
8089
console.log(yellow(` ↺ Skipping duplicate: "${bold(commit.header)}"`));
8190
return false;

0 commit comments

Comments
 (0)