Support concatenation of multiple private keys in the given secret

This commit is contained in:
Matthias Pigulla 2020-01-10 20:04:06 +00:00
parent ea39f521c5
commit 1bc48df605
4 changed files with 59 additions and 17 deletions

View file

@ -17,7 +17,11 @@ try {
core.exportVariable('SSH_AUTH_SOCK', authSock);
console.log("Adding private key to agent");
child_process.execSync('ssh-add -', { input: core.getInput('ssh-private-key') });
core.getInput('ssh-private-key').split(/(?=-----BEGIN)/).forEach(function(key) {
child_process.execSync('ssh-add -', { input: key.trim() + "\n" });
});
console.log("Keys added:");
child_process.execSync('ssh-add -l', { stdio: 'inherit' });
} catch (error) {
core.setFailed(error.message);
}