Skip to content

Commit

Permalink
fix: persist agent pid in state instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0wCrack committed Sep 19, 2024
1 parent 7e185f2 commit 5ade4b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
}
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== '') {
Expand Down

0 comments on commit 5ade4b9

Please sign in to comment.