Skip to content

Commit

Permalink
feat: link workspace changelog entries to release
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Dec 6, 2022
1 parent 9037b9d commit bf5f727
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/release-please/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ module.exports = (gh) => {
pull: (number) => url('pull', number),
commit: (sha) => url('commit', sha),
compare: (a, b) => a ? url('compare', `${a.toString()}...${b.toString()}`) : null,
release: (tag) => url('releases', 'tag', tag.toString()),
}
}
5 changes: 2 additions & 3 deletions lib/release-please/node-workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ module.exports = class extends NodeWorkspace {
this.releasesByPackage.set(packageName, {
path,
component,
currentTag: releasesByPath[path]?.tag,
})
}

Expand Down Expand Up @@ -139,9 +138,9 @@ module.exports = class extends NodeWorkspace {
// Update notes with a link to each workspaces release notes
// now that we have all of the releases in a single pull request
release.notes = release.notes.replace(WORKSPACE_DEP, (_, depName, depVersion) => {
const { currentTag, path, component } = this.releasesByPackage.get(depName)
const { path, component } = this.releasesByPackage.get(depName)

const url = this.gh.compare(currentTag, new TagName(
const url = this.gh.release(new TagName(
depVersion,
component,
this.repositoryConfig[path].tagSeparator,
Expand Down
6 changes: 6 additions & 0 deletions test/release-please/node-workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ t.test('root and ws fixes', async t => {
.filter(u => u.updater.rawContent)
.map(u => JSON.parse(u.updater.rawContent))

t.match(
pullRequest.body.releaseData[0].notes,
'[Workspace](https://github.com/npm/cli/releases/tag/a-v2.2.3)',
'contains release link for workspace'
)

t.strictSame(pkgs, [
{
name: '@npmcli/a',
Expand Down

0 comments on commit bf5f727

Please sign in to comment.