Fixed an issue with GitHub releases not being created for successfully published packages when some packages failed to be published (#535)

* Fixed an issue with GitHub releases not being created for successfully published packages when some packages failed to be published

* Format

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
Mateusz Burzyński
2026-05-29 06:48:06 +00:00
committed by GitHub
co-authored by Bjorn Lu
parent 1d54b9e660
commit 34f64f6e2e
3 changed files with 23 additions and 1 deletions
+13
View File
@@ -136,6 +136,19 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
JSON.stringify(result.publishedPackages),
);
}
if (result.exitCode !== 0) {
core.error(
`Publish command exited with code ${result.exitCode}${
result.published
? `, but some packages were published: ${result.publishedPackages
.map((p) => `${p.name}@${p.version}`)
.join(", ")}`
: ""
}`,
);
process.exit(result.exitCode);
}
return;
}
case hasChangesets && !hasNonEmptyChangesets:
+5 -1
View File
@@ -73,9 +73,11 @@ type PublishResult =
| {
published: true;
publishedPackages: PublishedPackage[];
exitCode: number;
}
| {
published: false;
exitCode: number;
};
export async function runPublish({
@@ -88,6 +90,7 @@ export async function runPublish({
}: PublishOptions): Promise<PublishResult> {
let changesetPublishOutput = await getExecOutput(script, undefined, {
cwd,
ignoreReturnCode: true,
env: { ...process.env, GITHUB_TOKEN: githubToken },
});
@@ -155,10 +158,11 @@ export async function runPublish({
name: pkg.packageJson.name,
version: pkg.packageJson.version,
})),
exitCode: changesetPublishOutput.exitCode,
};
}
return { published: false };
return { published: false, exitCode: changesetPublishOutput.exitCode };
}
const requireChangesetsCliPkgJson = (cwd: string) => {