add git deploy key wrapper functionality

This commit is contained in:
Michael Carlson 2020-11-23 21:58:33 -07:00
parent 73d2440ad4
commit 17860381fc
9 changed files with 88 additions and 8 deletions

9
dist/index.js vendored
View file

@ -163,6 +163,15 @@ try {
console.log("Keys added:");
child_process.execSync('ssh-add -l', { stdio: 'inherit' });
const useGitSSHWrapper = core.getInput('use-git-deploy-key-wrapper');
if(useGitSSHWrapper) {
const gitSSHWrapperFileName = 'git-deploy-key-wrapper.sh';
const gitSSHWrapperPath = path.join(homeSsh, gitSSHWrapperFileName);
fs.copyFileSync(path.join(process.cwd(), gitSSHWrapperFileName), gitSSHWrapperPath);
fs.chmodSync(gitSSHWrapperPath, "755");
core.exportVariable('GIT_SSH_COMMAND', gitSSHWrapperPath);
}
} catch (error) {
core.setFailed(error.message);
}