Skip to content

Commit 2e542e0

Browse files
authored
fix: compare exact npm release versions
Make the idempotent release guard reliable under GitHub Actions.
1 parent 28c4039 commit 2e542e0

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

scripts/release-if-needed.mjs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ const unpublishedPackages = publishablePackages.filter((packagePath) => {
77
const localPackage = JSON.parse(readFileSync(packagePath, "utf8"));
88

99
try {
10-
const publishedVersion = JSON.parse(
11-
execFileSync("npm", ["view", localPackage.name, "version", "--json"], {
12-
encoding: "utf8",
13-
stdio: ["ignore", "pipe", "pipe"],
14-
}),
15-
);
10+
const exactVersion = execFileSync(
11+
"npm",
12+
["view", `${localPackage.name}@${localPackage.version}`, "version"],
13+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] },
14+
).trim();
1615

17-
return publishedVersion !== localPackage.version;
16+
return exactVersion !== localPackage.version;
1817
} catch {
1918
return true;
2019
}

0 commit comments

Comments
 (0)