File tree Expand file tree Collapse file tree 4 files changed +12
-20
lines changed
Expand file tree Collapse file tree 4 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ inputs:
1111 description : ' If apt should be executed with sudo or without'
1212 required : false
1313 default : ' true'
14- install_dependencies :
14+ install-dependencies :
1515 description : ' Whether or not to install dependencies for tmate on linux (openssh-client, xz-utils)'
1616 required : false
1717 default : ' true'
@@ -34,4 +34,4 @@ inputs:
3434 tmate-server-ed25519-fingerprint :
3535 description : ' The ed25519 fingerprint for your tmate server'
3636 required : false
37- default : ' '
37+ default : ' '
Original file line number Diff line number Diff line change @@ -10317,13 +10317,7 @@ const TMATE_ARCH_MAP = {
1031710317/** @param {number } ms */
1031810318const sleep = ( ms ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
1031910319
10320- async function installDependenciesLinux ( optionalSudoPrefix = 'sudo' ) {
10321- await execShellCommand ( optionalSudoPrefix + 'apt-get update' ) ;
10322- await execShellCommand ( optionalSudoPrefix + 'apt-get install -y openssh-client xz-utils' ) ;
10323- }
10324-
1032510320async function run ( ) {
10326- const optionalSudoPrefix = core . getInput ( 'sudo' ) === "true" ? "sudo " : "" ;
1032710321 try {
1032810322 core . debug ( "Installing dependencies" )
1032910323 let tmateExecutable = "tmate"
@@ -10333,8 +10327,10 @@ async function run() {
1033310327 await execShellCommand ( 'pacman -Sy --noconfirm tmate' ) ;
1033410328 tmateExecutable = 'CHERE_INVOKING=1 tmate'
1033510329 } else {
10336- if ( core . getInput ( 'install_dependencies' ) === "true" ) {
10337- await installDependenciesLinux ( optionalSudoPrefix ) ;
10330+ if ( core . getInput ( "install-dependencies" ) === "true" ) {
10331+ const optionalSudoPrefix = core . getInput ( "sudo" ) === "true" ? "sudo " : "" ;
10332+ await execShellCommand ( optionalSudoPrefix + "apt-get update" ) ;
10333+ await execShellCommand ( optionalSudoPrefix + "apt-get install -y openssh-client xz-utils" ) ;
1033810334 }
1033910335
1034010336 const tmateArch = TMATE_ARCH_MAP [ external_os_default ( ) . arch ( ) ] ;
Original file line number Diff line number Diff line change @@ -24,13 +24,7 @@ const TMATE_ARCH_MAP = {
2424/** @param {number } ms */
2525const sleep = ( ms ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
2626
27- export async function installDependenciesLinux ( optionalSudoPrefix = 'sudo' ) {
28- await execShellCommand ( optionalSudoPrefix + 'apt-get update' ) ;
29- await execShellCommand ( optionalSudoPrefix + 'apt-get install -y openssh-client xz-utils' ) ;
30- }
31-
3227export async function run ( ) {
33- const optionalSudoPrefix = core . getInput ( 'sudo' ) === "true" ? "sudo " : "" ;
3428 try {
3529 core . debug ( "Installing dependencies" )
3630 let tmateExecutable = "tmate"
@@ -40,8 +34,10 @@ export async function run() {
4034 await execShellCommand ( 'pacman -Sy --noconfirm tmate' ) ;
4135 tmateExecutable = 'CHERE_INVOKING=1 tmate'
4236 } else {
43- if ( core . getInput ( 'install_dependencies' ) === "true" ) {
44- await installDependenciesLinux ( optionalSudoPrefix ) ;
37+ if ( core . getInput ( "install-dependencies" ) === "true" ) {
38+ const optionalSudoPrefix = core . getInput ( "sudo" ) === "true" ? "sudo " : "" ;
39+ await execShellCommand ( optionalSudoPrefix + "apt-get update" ) ;
40+ await execShellCommand ( optionalSudoPrefix + "apt-get install -y openssh-client xz-utils" ) ;
4541 }
4642
4743 const tmateArch = TMATE_ARCH_MAP [ os . arch ( ) ] ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ describe('Tmate GitHub integration', () => {
5454 Object . defineProperty ( process , "platform" , {
5555 value : "linux"
5656 } )
57- core . getInput . mockReturnValueOnce ( "false" ) . mockReturnValueOnce ( " true") . mockReturnValue ( "false" )
57+ core . getInput . mockReturnValueOnce ( "true" ) . mockReturnValueOnce ( "false" )
5858 const customConnectionString = "foobar"
5959 execShellCommand . mockReturnValue ( Promise . resolve ( customConnectionString ) )
6060 await run ( )
@@ -63,7 +63,7 @@ describe('Tmate GitHub integration', () => {
6363 expect ( core . info ) . toHaveBeenNthCalledWith ( 2 , `SSH: ${ customConnectionString } ` ) ;
6464 expect ( core . info ) . toHaveBeenNthCalledWith ( 3 , "Exiting debugging session because the continue file was created" ) ;
6565 } ) ;
66- it ( 'should be handle the main loop for linux without installing dependencies ' , async ( ) => {
66+ it ( 'should be handle the main loop for linux without dependency installation ' , async ( ) => {
6767 Object . defineProperty ( process , "platform" , {
6868 value : "linux"
6969 } )
You can’t perform that action at this time.
0 commit comments