Skip to content

Commit 819ed29

Browse files
mifisindresorhus
authored andcommitted
Fix broken revert code after publish failure
1 parent d49dd4f commit 819ed29

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: source/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ const np = async (input = 'patch', options, {pkg, rootDir, isYarnBerry}) => {
7373
const latestTag = await git.latestTag();
7474
const versionInLatestTag = latestTag.slice(tagVersionPrefix.length);
7575

76+
async function getPkgVersion() {
77+
const pkg = await util.readPkg(rootDir);
78+
return pkg.version;
79+
}
80+
7681
try {
7782
// Verify that the package's version has been bumped before deleting the last tag and commit.
78-
if (versionInLatestTag === util.readPkg(rootDir).version && versionInLatestTag !== pkg.version) {
83+
if (versionInLatestTag === await getPkgVersion() && versionInLatestTag !== pkg.version) {
7984
await git.deleteTag(latestTag);
8085
await git.removeLastCommit();
8186
}

0 commit comments

Comments
 (0)