Set private-key as non required (#49)

Co-authored-by: benjaminmal <bbenben778@gmail.com>
This commit is contained in:
Benjamin 2022-10-01 18:13:45 +02:00 committed by GitHub
commit 162add4f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View file

@ -22,8 +22,11 @@ async function ssh() {
execa.sync('ssh-agent', ['-a', authSock])
core.exportVariable('SSH_AUTH_SOCK', authSock)
let privateKey = core.getInput('private-key').replace('/\r/g', '').trim() + '\n'
execa.sync('ssh-add', ['-'], {input: privateKey})
let privateKey = core.getInput('private-key')
if (privateKey !== '') {
privateKey = privateKey.replace('/\r/g', '').trim() + '\n'
execa.sync('ssh-add', ['-'], {input: privateKey})
}
const knownHosts = core.getInput('known-hosts')
if (knownHosts !== '') {