-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (25 loc) · 737 Bytes
/
index.js
File metadata and controls
32 lines (25 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const core = require('@actions/core');
const SSH2Shell = require("ssh2shell");
try {
/* SSH input commands */
const commands = core.getInput('commands');
/* Splitting commands if there are multiple */
let items = commands.split("\n");
const host = {
server: {
host: core.getInput('host'),
userName: core.getInput('username'),
password: core.getInput('password')
},
commands: items,
}
/* creating new SSH client */
const SSH = new SSH2Shell(host);
/* Connecting... */
SSH.connect(function(sessionText){
/* Response text */
console.log(sessionText);
});
} catch (error) {
core.setFailed(error.message);
}