Improve log messages (#730)

This commit is contained in:
Bjorn Lu
2026-09-04 18:07:20 +00:00
committed by GitHub
parent 371fd77b45
commit e08fde7435
4 changed files with 13 additions and 9 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---
Improve log messages
+2 -2
View File
@@ -195,7 +195,7 @@ export class GitHub {
if (authorIdentity.exitCode === 0 && committerIdentity.exitCode === 0) { if (authorIdentity.exitCode === 0 && committerIdentity.exitCode === 0) {
return; 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]"`], { await exec("git", ["config", "user.name", `"github-actions[bot]"`], {
cwd: this.cwd, cwd: this.cwd,
}); });
@@ -222,7 +222,7 @@ export class GitHub {
}) })
.catch((err) => { .catch((err) => {
// Assuming tag was manually pushed in custom publish script // 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], { await exec("git", ["push", "origin", tag], {
+3 -4
View File
@@ -68,7 +68,7 @@ async function main() {
switch (true) { switch (true) {
case !hasChangesets && !hasPublishScript: case !hasChangesets && !hasPublishScript:
core.info( 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; return;
case !hasChangesets && hasPublishScript: { case !hasChangesets && hasPublishScript: {
@@ -104,7 +104,7 @@ async function main() {
} }
if (result.exitCode !== 0) { if (result.exitCode !== 0) {
core.error( throw new Error(
`Publish command exited with code ${result.exitCode}${ `Publish command exited with code ${result.exitCode}${
result.published result.published
? `, but some packages were published: ${result.publishedPackages ? `, but some packages were published: ${result.publishedPackages
@@ -113,12 +113,11 @@ async function main() {
: "" : ""
}`, }`,
); );
process.exit(result.exitCode);
} }
return; return;
} }
case hasChangesets && !hasNonEmptyChangesets: case hasChangesets && !hasNonEmptyChangesets:
core.info("All changesets are empty; not creating PR"); core.info("All changesets are empty. Not creating PR");
return; return;
case hasChangesets: { case hasChangesets: {
const { pullRequestNumber } = await runVersion({ const { pullRequestNumber } = await runVersion({
+3 -3
View File
@@ -401,7 +401,7 @@ export async function runVersion({
head: `${context.repo.owner}:${versionBranch}`, head: `${context.repo.owner}:${versionBranch}`,
base: branch, base: branch,
}); });
core.info( core.debug(
`Existing pull requests: ${JSON.stringify( `Existing pull requests: ${JSON.stringify(
existingPullRequests.data, existingPullRequests.data,
null, null,
@@ -427,7 +427,7 @@ export async function runVersion({
}); });
if (existingPullRequests.data.length === 0) { if (existingPullRequests.data.length === 0) {
core.info("creating pull request"); core.info("Creating pull request");
const { data: newPullRequest } = await octokit.rest.pulls.create({ const { data: newPullRequest } = await octokit.rest.pulls.create({
base: branch, base: branch,
head: versionBranch, head: versionBranch,
@@ -443,7 +443,7 @@ export async function runVersion({
} else { } else {
const [pullRequest] = existingPullRequests.data; const [pullRequest] = existingPullRequests.data;
core.info(`updating found pull request #${pullRequest.number}`); core.info(`Updating found pull request #${pullRequest.number}`);
const convertPullRequestToDraftMutation = const convertPullRequestToDraftMutation =
prDraft === "always" prDraft === "always"
? ` ? `