From 770f4ff9098be69283ca343bf032754cc50161c1 Mon Sep 17 00:00:00 2001 From: bluwy Date: Wed, 26 Aug 2026 09:56:39 +0800 Subject: [PATCH] Improve log messages --- .changeset/flat-insects-cry.md | 5 +++++ src/github.ts | 4 ++-- src/index.ts | 7 +++---- src/run.ts | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 .changeset/flat-insects-cry.md diff --git a/.changeset/flat-insects-cry.md b/.changeset/flat-insects-cry.md new file mode 100644 index 00000000..ceb94474 --- /dev/null +++ b/.changeset/flat-insects-cry.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": patch +--- + +Improve log messages diff --git a/src/github.ts b/src/github.ts index c03cbda8..55251eb7 100644 --- a/src/github.ts +++ b/src/github.ts @@ -195,7 +195,7 @@ export class GitHub { if (authorIdentity.exitCode === 0 && committerIdentity.exitCode === 0) { return; } - core.info("Setting Git user to github-actions[bot]"); + core.info("Setting git user to github-actions[bot]"); await exec("git", ["config", "user.name", `"github-actions[bot]"`], { cwd: this.cwd, }); @@ -222,7 +222,7 @@ export class GitHub { }) .catch((err) => { // Assuming tag was manually pushed in custom publish script - core.warning(`Failed to create tag ${tag}: ${err.message}`); + core.warning(`Failed to create git tag "${tag}": ${err.message}`); }); } await exec("git", ["push", "origin", tag], { diff --git a/src/index.ts b/src/index.ts index 63e458c2..9aa2e326 100644 --- a/src/index.ts +++ b/src/index.ts @@ -68,7 +68,7 @@ async function main() { switch (true) { case !hasChangesets && !hasPublishScript: core.info( - "No changesets present or were removed by merging release PR. Not publishing because no publish script found.", + "No changesets present or were removed by merging version PR. Not publishing because publish-script is not set.", ); return; case !hasChangesets && hasPublishScript: { @@ -104,7 +104,7 @@ async function main() { } if (result.exitCode !== 0) { - core.error( + throw new Error( `Publish command exited with code ${result.exitCode}${ result.published ? `, but some packages were published: ${result.publishedPackages @@ -113,12 +113,11 @@ async function main() { : "" }`, ); - process.exit(result.exitCode); } return; } case hasChangesets && !hasNonEmptyChangesets: - core.info("All changesets are empty; not creating PR"); + core.info("All changesets are empty. Not creating PR"); return; case hasChangesets: { const { pullRequestNumber } = await runVersion({ diff --git a/src/run.ts b/src/run.ts index 37dd2806..08f00dea 100644 --- a/src/run.ts +++ b/src/run.ts @@ -401,7 +401,7 @@ export async function runVersion({ head: `${context.repo.owner}:${versionBranch}`, base: branch, }); - core.info( + core.debug( `Existing pull requests: ${JSON.stringify( existingPullRequests.data, null, @@ -427,7 +427,7 @@ export async function runVersion({ }); if (existingPullRequests.data.length === 0) { - core.info("creating pull request"); + core.info("Creating pull request"); const { data: newPullRequest } = await octokit.rest.pulls.create({ base: branch, head: versionBranch, @@ -443,7 +443,7 @@ export async function runVersion({ } else { const [pullRequest] = existingPullRequests.data; - core.info(`updating found pull request #${pullRequest.number}`); + core.info(`Updating found pull request #${pullRequest.number}`); const convertPullRequestToDraftMutation = prDraft === "always" ? `