Replace main branch in changelog link with tags (#19054)
This commit is contained in:
1 parent
8c7e6d4338
commit
946065810a
2 files changed
+4
-7
No files matched your search
@@ -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}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user