Skip to content

Commit

Permalink
feat: handle otp error on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
syi0808 committed Oct 12, 2024
1 parent 461d217 commit 3d703e5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/tasks/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ export const npmPublishTasks: ListrTask<Ctx> = {
);
}

await npm.publishProvenance();
try {
await npm.publishProvenance();
} catch (error) {
if (`${error}`.includes('EOTP')) {
throw new NpmAvailableError(
`In CI environment, publishing with 2FA is not allowed. Please disable 2FA when accessing with a token from ${link('npm', `https://www.npmjs.com/package/${npm.packageName}/access`)}.`,
);
}

throw error;
}
}
},
};

0 comments on commit 3d703e5

Please sign in to comment.