deployphp/cleanup.js
2024-09-19 15:09:27 +10:00

22 lines
428 B
JavaScript

import core from '@actions/core'
import { $ } from 'zx'
void (async function main() {
try {
await cleanup()
} catch (err) {
core.setFailed(err.message)
}
})()
async function cleanup() {
if (core.getBooleanInput('skip-ssh-setup')) {
return
}
const sshAgentPid = core.getState('ssh-agent-pid')
// Remove all keys from ssh-agent and kill process
await $`ssh-add -D`
await $`kill ${sshAgentPid}`
}