Skip to content

Commit f9797b2

Browse files
committed
Added SCRIPT_BEFORE_REQUIRED and SCRIPT_AFTER_REQUIRED flags for error throwing on remote cmd errors
1 parent 3884c85 commit f9797b2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const run = async () => {
1010
source, remoteUser, remoteHost, remotePort,
1111
deployKeyName, sshPrivateKey,
1212
args, exclude, sshCmdArgs,
13-
scriptBefore, scriptAfter,
13+
scriptBefore, scriptBeforeRequired,
14+
scriptAfter, scriptAfterRequired,
1415
rsyncServer
1516
} = inputs;
1617
// Validate required inputs
@@ -24,7 +25,7 @@ const run = async () => {
2425
}
2526
// Check Script before
2627
if (scriptBefore) {
27-
await remoteCmdBefore(scriptBefore, privateKeyPath);
28+
await remoteCmdBefore(scriptBefore, privateKeyPath, scriptBeforeRequired);
2829
}
2930
/* eslint-disable object-property-newline */
3031
await sshDeploy({
@@ -33,7 +34,7 @@ const run = async () => {
3334
});
3435
// Check script after
3536
if (scriptAfter) {
36-
await remoteCmdAfter(scriptAfter, privateKeyPath);
37+
await remoteCmdAfter(scriptAfter, privateKeyPath, scriptAfterRequired);
3738
}
3839
};
3940

src/inputs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const inputNames = [
44
'REMOTE_HOST', 'REMOTE_USER', 'REMOTE_PORT',
55
'SSH_PRIVATE_KEY', 'DEPLOY_KEY_NAME',
66
'SOURCE', 'TARGET', 'ARGS', 'SSH_CMD_ARGS', 'EXCLUDE',
7-
'SCRIPT_BEFORE', 'SCRIPT_AFTER'];
7+
'SCRIPT_BEFORE', 'SCRIPT_AFTER', 'SCRIPT_BEFORE_REQUIRED', 'SCRIPT_AFTER_REQUIRED'];
88

99
const githubWorkspace = process.env.GITHUB_WORKSPACE;
1010
const remoteUser = process.env.REMOTE_USER || process.env.INPUT_REMOTE_USER;

0 commit comments

Comments
 (0)