diff --git a/scripts/release/steps/show-instructions-after-npm-publish.js b/scripts/release/steps/show-instructions-after-npm-publish.js index d5663095f..a90f54fef 100644 --- a/scripts/release/steps/show-instructions-after-npm-publish.js +++ b/scripts/release/steps/show-instructions-after-npm-publish.js @@ -11,10 +11,11 @@ const RELEASE_URL_BASE = "https://github.com/prettier/prettier/releases/new?"; export function getReleaseUrl(version, previousVersion) { const semverDiff = semver.diff(version, previousVersion); const isPatch = semverDiff === "patch"; + const tag = version; let body; if (isPatch) { const urlToChangelog = - "https://github.com/prettier/prettier/blob/main/CHANGELOG.md#" + + `https://github.com/prettier/prettier/blob/${tag}/CHANGELOG.md#` + version.split(".").join(""); body = `🔗 [Changelog](${urlToChangelog})`; } else { @@ -25,11 +26,7 @@ export function getReleaseUrl(version, previousVersion) { body: `🔗 [Release note](https://prettier.io/${blogPostInfo.path})`, }); } - const parameters = new URLSearchParams({ - tag: version, - title: version, - body, - }); + const parameters = new URLSearchParams({ tag, title: version, body }); return `${RELEASE_URL_BASE}${parameters}`; } diff --git a/scripts/release/tests/publish-to-npm.test.js b/scripts/release/tests/publish-to-npm.test.js index 6f03106ce..b3260e268 100644 --- a/scripts/release/tests/publish-to-npm.test.js +++ b/scripts/release/tests/publish-to-npm.test.js @@ -24,7 +24,7 @@ describe("publish-to-npm", () => { getExpectedReleaseUrl({ tag: "2.3.1", title: "2.3.1", - body: "🔗 [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#231)", + body: "🔗 [Changelog](https://github.com/prettier/prettier/blob/2.3.1/CHANGELOG.md#231)", }), ); });