Skip to content

Commit 4f8376e

Browse files
committed
fixup! feat: add confirmation steps to any write operation
1 parent 3545e28 commit 4f8376e

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

lib/security-release/security-release.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@ function formatCommand(command, args) {
3535
}
3636

3737
export async function confirmSecurityStep(cli, action, detail) {
38-
const lines = [`Allow action: ${action}?`];
38+
let message = `Allow action: ${action}?`;
3939
if (detail) {
40-
lines.push('', detail);
40+
message += `\n\n${detail}`;
4141
}
42-
const message = lines.join('\n');
4342

4443
const allowed = await cli.prompt(message, { defaultAnswer: false });
4544
if (!allowed) {
46-
cli.info(`Aborted: ${action}.`);
47-
process.exit(0);
45+
throw new Error(`Aborted: ${action}.`);
4846
}
4947
}
5048

@@ -97,18 +95,10 @@ export async function commitAndPushVulnerabilitiesJSON(
9795

9896
if (Array.isArray(filePath)) {
9997
for (const currentPath of filePath) {
100-
await runSecurityGitCommand(
101-
cli,
102-
['add', currentPath],
103-
`This stages ${currentPath} for the security release commit.`
104-
);
98+
runSync('git', ['add', currentPath]);
10599
}
106100
} else {
107-
await runSecurityGitCommand(
108-
cli,
109-
['add', filePath],
110-
`This stages ${filePath} for the security release commit.`
111-
);
101+
runSync('git', ['add', filePath]);
112102
}
113103

114104
const staged = runSync('git', ['diff', '--name-only', '--cached']).trim();

0 commit comments

Comments
 (0)