Skip to content

Commit

Permalink
fix: dont allow release-please to update workspace changelogs (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored Dec 6, 2023
1 parent 3e9444e commit acd6429
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
22 changes: 0 additions & 22 deletions lib/release/node-workspace-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 7 additions & 0 deletions lib/release/node-workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit acd6429

Please sign in to comment.