File tree 1 file changed +24
-22
lines changed
1 file changed +24
-22
lines changed Original file line number Diff line number Diff line change 5
5
6
6
/* SSH input commands */
7
7
const commands = core . getInput ( 'commands' ) ;
8
- if ( commands ) {
9
- console . log ( commands )
10
- let items = commands . split ( "\n" ) ;
11
- console . log ( items )
12
- } else {
13
- const host = {
14
- server : {
15
- host : core . getInput ( 'host' ) ,
16
- userName : core . getInput ( 'username' ) ,
17
- password : core . getInput ( 'password' )
18
- } ,
19
- commands : [ ssh_1 , ssh_2 , ssh_3 , ssh_4 ]
20
- }
21
- /* creating new SSH client */
22
- const SSH = new SSH2Shell ( host ) ;
23
-
24
- /* Connecting... */
25
- SSH . connect ( function ( sessionText ) {
26
- /* Response text */
27
- console . log ( sessionText ) ;
28
- console . log ( "Successfully executed ssh commands!" ) ;
29
- } ) ;
8
+
9
+ /* Splitting commands if there are multiple */
10
+ let items = commands . split ( "\n" ) ;
11
+
12
+ const host = {
13
+ server : {
14
+ host : core . getInput ( 'host' ) ,
15
+ userName : core . getInput ( 'username' ) ,
16
+ password : core . getInput ( 'password' )
17
+ } ,
18
+ commands : [ items ] ,
30
19
}
20
+
21
+ /* creating new SSH client */
22
+ const SSH = new SSH2Shell ( host ) ;
23
+
24
+ /* Connecting... */
25
+ SSH . connect ( function ( sessionText ) {
26
+ /* Response text */
27
+ console . log ( sessionText ) ;
28
+ if ( sessionText == 'Ready' ) {
29
+ console . log ( "Successfully executed ssh commands!" ) ;
30
+ }
31
+ } ) ;
32
+
31
33
} catch ( error ) {
32
34
core . setFailed ( error . message ) ;
33
35
}
You can’t perform that action at this time.
0 commit comments