4fcb25e7ef
Thanks to @thommyhh for this contribution! Unless the `SSH_AUTH_SOCK` is configured explicitly, this change will make the SSH agent use a random file name for the socket. That way, multiple, concurrent SSH agents can be used on non-ephemeral, self-hosted runners. A new post-action step will automatically clean up the running agent at the end of a job. Be aware of the possible security implications: Two jobs running on the same runner might be able to access each other's socket and thus access repositories and/or hosts.
10 lines
277 B
JavaScript
10 lines
277 B
JavaScript
const core = require('@actions/core')
|
|
const { execSync } = require('child_process')
|
|
|
|
try {
|
|
// Kill the started SSH agent
|
|
console.log('Stopping SSH agent')
|
|
execSync('kill ${SSH_AGENT_PID}', { stdio: 'inherit' })
|
|
} catch (error) {
|
|
core.setFailed(error.message)
|
|
}
|