Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/flat-insects-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Improve log messages
4 changes: 2 additions & 2 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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], {
Expand Down
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
Expand All @@ -113,12 +113,11 @@ async function main() {
: ""
}`,
);
process.exit(result.exitCode);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed as I changed to a throw above, which core.setFailed will make the exit code 1 by default. But while this might be a different exit code than result.exitCode, it doesn't matter in practice as GitHub Actions only has two states: success and failure, which are checked by 0 and non-0 only.

}
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({
Expand Down
6 changes: 3 additions & 3 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export async function runVersion({
head: `${context.repo.owner}:${versionBranch}`,
base: branch,
});
core.info(
core.debug(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this info to bloat the logs in practice, so moved this to debug, which can be viewed when the user re-runs the action in debug mode.

`Existing pull requests: ${JSON.stringify(
existingPullRequests.data,
null,
Expand All @@ -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,
Expand All @@ -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"
? `
Expand Down