File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36644,9 +36644,13 @@ async function ssh() {
3664436644 if (getBooleanInput("skip-ssh-setup")) return;
3664536645 const sshHomeDir = `${process.env["HOME"]}/.ssh`;
3664636646 if (!fs.existsSync(sshHomeDir)) fs.mkdirSync(sshHomeDir);
36647- const authSock = "/tmp/ssh-auth.sock";
36648- await $`ssh-agent -a ${authSock}`;
36649- exportVariable("SSH_AUTH_SOCK", authSock);
36647+ const existingAuthSock = process.env["SSH_AUTH_SOCK"];
36648+ if (existingAuthSock !== void 0 && existingAuthSock !== "" && fs.existsSync(existingAuthSock)) console.log(`Using existing SSH agent socket at ${existingAuthSock}.`);
36649+ else {
36650+ const authSock = "/tmp/ssh-auth.sock";
36651+ await $`ssh-agent -a ${authSock}`;
36652+ exportVariable("SSH_AUTH_SOCK", authSock);
36653+ }
3665036654 let privateKey = getInput("private-key");
3665136655 if (privateKey !== "") {
3665236656 privateKey = privateKey.replace(/\r/g, "").trim() + "\n";
Original file line number Diff line number Diff line change @@ -33,9 +33,14 @@ async function ssh(): Promise<void> {
3333 fs . mkdirSync ( sshHomeDir )
3434 }
3535
36- const authSock = '/tmp/ssh-auth.sock'
37- await $ `ssh-agent -a ${ authSock } `
38- core . exportVariable ( 'SSH_AUTH_SOCK' , authSock )
36+ const existingAuthSock = process . env [ 'SSH_AUTH_SOCK' ]
37+ if ( existingAuthSock !== undefined && existingAuthSock !== '' && fs . existsSync ( existingAuthSock ) ) {
38+ console . log ( `Using existing SSH agent socket at ${ existingAuthSock } .` )
39+ } else {
40+ const authSock = '/tmp/ssh-auth.sock'
41+ await $ `ssh-agent -a ${ authSock } `
42+ core . exportVariable ( 'SSH_AUTH_SOCK' , authSock )
43+ }
3944
4045 let privateKey = core . getInput ( 'private-key' )
4146 if ( privateKey !== '' ) {
You can’t perform that action at this time.
0 commit comments