From acd64294a39d7c53ca3c9142fbbf12419974d0cc Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 6 Dec 2023 14:20:22 -0700 Subject: [PATCH] fix: dont allow release-please to update workspace changelogs (#398) --- lib/release/node-workspace-format.js | 22 ---------------------- lib/release/node-workspace.js | 7 +++++++ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/lib/release/node-workspace-format.js b/lib/release/node-workspace-format.js index 46b4db91..4eca1ea5 100644 --- a/lib/release/node-workspace-format.js +++ b/lib/release/node-workspace-format.js @@ -53,28 +53,6 @@ module.exports = class extends ManifestPlugin { return `${link(scope, url)}: ${wrapSpecs(`${name}@${version}`)}` }) - // remove the other release please dependencies list which always starts with - // the following line and then each line is indented. so we search for the line - // and remove and indented lines until the next non indented line. - let foundRemoveStart = false - let foundRemoveEnd = false - release.notes = release.notes - .split('\n') - .filter((line) => { - if (line === '* The following workspace dependencies were updated') { - foundRemoveStart = true - } else if (foundRemoveStart && !foundRemoveEnd) { - // TODO: test when inserted dependencies is not the last thing in the changelog - /* istanbul ignore next */ - if (!line || !line.startsWith(' ')) { - foundRemoveEnd = true - } - } - // If we found the start, remove all lines until we've found the end - return foundRemoveStart ? foundRemoveEnd : true - }) - .join('\n') - // Find the associated changelog and update that too const path = this.#pathsByComponent.get(release.component) for (const update of candidate.pullRequest.updates) { diff --git a/lib/release/node-workspace.js b/lib/release/node-workspace.js index 4f13f912..93ef00f6 100644 --- a/lib/release/node-workspace.js +++ b/lib/release/node-workspace.js @@ -12,6 +12,13 @@ const { WORKSPACE_MESSAGE } = require('./node-workspace-format') // release-please ourselves. /* istanbul ignore next: TODO fix flaky tests and enable coverage */ class NpmNodeWorkspace extends NodeWorkspace { + updateCandidate (pr) { + // no-op so release-please node-workspace plugin does not add + // its broken changelog to the workspace releases. our changelog + // formatting and the preconfigure method below fix this. + return pr + } + async preconfigure (strategiesByPath, commitsByPath, releasesByPath) { // First build a list of all releases that will happen based on the // conventional commits