From 9c39ff90358408c53794254eed6f970893e2730f Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 29 Jul 2024 16:00:43 -0400 Subject: [PATCH] Fix commit and pr text for release --- .changeset/light-readers-rest.md | 5 +++++ packages/tool.release/src/runVersion.ts | 10 +++++++--- packages/tool.release/src/util/getVersionPrBody.ts | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changeset/light-readers-rest.md diff --git a/.changeset/light-readers-rest.md b/.changeset/light-readers-rest.md new file mode 100644 index 000000000..c8e139644 --- /dev/null +++ b/.changeset/light-readers-rest.md @@ -0,0 +1,5 @@ +--- +"@osdk/tool.release": minor +--- + +Properly generate titles and body copy after exiting pre mode diff --git a/packages/tool.release/src/runVersion.ts b/packages/tool.release/src/runVersion.ts index 6ea6ce75c..c22e3b298 100644 --- a/packages/tool.release/src/runVersion.ts +++ b/packages/tool.release/src/runVersion.ts @@ -194,9 +194,13 @@ export async function runVersion({ } else { // project with `commit: true` setting could have already committed files if (!(await gitUtils.checkIfClean())) { - const finalCommitMessage = `${commitMessage}${ - !!preState ? ` (${preState.tag})` : "" - }`; + let finalCommitMessage = commitMessage; + if (preState && preState.mode === "pre") { + finalCommitMessage += ` (${preState.tag})`; + } else if (preState && preState.mode === "exit") { + finalCommitMessage += ` (exit ${preState.tag})`; + } + await gitUtils.commitAll(finalCommitMessage); } diff --git a/packages/tool.release/src/util/getVersionPrBody.ts b/packages/tool.release/src/util/getVersionPrBody.ts index 822d33ae0..6ae54d261 100644 --- a/packages/tool.release/src/util/getVersionPrBody.ts +++ b/packages/tool.release/src/util/getVersionPrBody.ts @@ -72,7 +72,7 @@ export async function getVersionPrBody({ `This PR was opened by automation. When you're ready to do a release, you can merge this and publish to npm yourself. If you're not ready to do a release yet, that's fine, whenever you re-run the release script in ${branch}, this PR will be updated. `; - const messagePreState = !!preState + const messagePreState = preState && preState.mode === "pre" ? `⚠️⚠️⚠️⚠️⚠️⚠️ \`${branch}\` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run \`changeset pre exit\` on \`${branch}\`.