From 5ade4b973dfd7fcdd2d8a136d4c137282b59bdb6 Mon Sep 17 00:00:00 2001 From: Sn0wCrack <442287+Sn0wCrack@users.noreply.github.com> Date: Thu, 19 Sep 2024 15:09:27 +1000 Subject: [PATCH] fix: persist agent pid in state instead --- cleanup.js | 4 +++- index.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cleanup.js b/cleanup.js index ef86c34..2ae0493 100644 --- a/cleanup.js +++ b/cleanup.js @@ -14,7 +14,9 @@ async function cleanup() { return } + const sshAgentPid = core.getState('ssh-agent-pid') + // Remove all keys from ssh-agent and kill process await $`ssh-add -D` - await $`kill \$SSH_AGENT_PID` + await $`kill ${sshAgentPid}` } diff --git a/index.js b/index.js index 7478775..3b556c4 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,9 @@ async function ssh() { } core.exportVariable('SSH_AUTH_SOCK', sshAgentSocket.trim()) - core.exportVariable('SSH_AGENT_PID', sshAgentProcessId.trim()) + core.exportVariable('SSH_AGENT_PID', ) + + core.saveState('ssh-agent-pid', sshAgentProcessId.trim()) let privateKey = core.getInput('private-key') if (privateKey !== '') {