Skip to content

Commit 074aaed

Browse files
committed
Replace main branch in changelog link with tags (#19054)
1 parent c22a003 commit 074aaed

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

scripts/release/steps/show-instructions-after-npm-publish.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ const RELEASE_URL_BASE = "https://github.com/prettier/prettier/releases/new?";
1111
export function getReleaseUrl(version, previousVersion) {
1212
const semverDiff = semver.diff(version, previousVersion);
1313
const isPatch = semverDiff === "patch";
14+
const tag = version;
1415
let body;
1516
if (isPatch) {
1617
const urlToChangelog =
17-
"https://github.com/prettier/prettier/blob/main/CHANGELOG.md#" +
18+
`https://github.com/prettier/prettier/blob/${tag}/CHANGELOG.md#` +
1819
version.split(".").join("");
1920
body = `🔗 [Changelog](${urlToChangelog})`;
2021
} else {
@@ -25,11 +26,7 @@ export function getReleaseUrl(version, previousVersion) {
2526
body: `🔗 [Release note](https://prettier.io/${blogPostInfo.path})`,
2627
});
2728
}
28-
const parameters = new URLSearchParams({
29-
tag: version,
30-
title: version,
31-
body,
32-
});
29+
const parameters = new URLSearchParams({ tag, title: version, body });
3330
return `${RELEASE_URL_BASE}${parameters}`;
3431
}
3532

scripts/release/tests/publish-to-npm.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe("publish-to-npm", () => {
2424
getExpectedReleaseUrl({
2525
tag: "2.3.1",
2626
title: "2.3.1",
27-
body: "🔗 [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#231)",
27+
body: "🔗 [Changelog](https://github.com/prettier/prettier/blob/2.3.1/CHANGELOG.md#231)",
2828
}),
2929
);
3030
});

0 commit comments

Comments
 (0)