From 50eb1df62e5f52e4bd4453a30e5fc6f726aa5735 Mon Sep 17 00:00:00 2001 From: Sn0wCrack <442287+Sn0wCrack@users.noreply.github.com> Date: Thu, 19 Sep 2024 15:24:55 +1000 Subject: [PATCH] fix: persisting ssh agent pid in environment variable chore: add comment explaining why we regex output --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 3b556c4..9655fab 100644 --- a/index.js +++ b/index.js @@ -21,6 +21,9 @@ async function ssh() { fs.mkdirSync(sshHomeDir) } + // Unfortunately running the output into bash or eval-ing it does + // not persist the exported environment variables, so instead we + // parse out the variables via regex, not ideal but works a treat. const sshAgentOutput = await $`ssh-agent` const sshAgentSocket = sshAgentOutput @@ -38,7 +41,7 @@ async function ssh() { } core.exportVariable('SSH_AUTH_SOCK', sshAgentSocket.trim()) - core.exportVariable('SSH_AGENT_PID', ) + core.exportVariable('SSH_AGENT_PID', sshAgentProcessId.trim()) core.saveState('ssh-agent-pid', sshAgentProcessId.trim())