1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00

add transpiled file

This commit is contained in:
shimataro 2023-10-09 18:36:30 +09:00
parent 3030f9c5d9
commit 4f9c73a958
No known key found for this signature in database
GPG key ID: BE92C05736911A9D

View file

@ -2832,9 +2832,14 @@ function setup() {
* cleanup function
*/
function cleanup() {
// remove ".ssh" directory
const sshDirName = removeSshDirectory();
console.log(`SSH key in ${sshDirName} has been removed successfully.`);
if (shouldRemoveSshDirectory()) {
// remove ".ssh" directory
const sshDirName = removeSshDirectory();
console.log(`SSH key in ${sshDirName} has been removed successfully.`);
}
else {
console.log(`Skip directory deletion.`);
}
}
/**
* create ".ssh" directory
@ -2940,6 +2945,25 @@ function shouldCreateKeyFile(keyFilePath, ifKeyExists) {
throw new Error(`SSH key is already installed. Set "if_key_exists" to "replace" or "ignore" in order to avoid this error.`);
}
}
/**
* should remove SSH directory?
* @returns Yes/No
*/
function shouldRemoveSshDirectory() {
const keepsSshDir = core.getInput("keep_ssh_dir", {
required: true,
});
// empty string or falsy value in YAML
switch (keepsSshDir.toLowerCase()) {
case "":
case "false":
case "no":
case "off":
return true;
default:
return false;
}
}
/**
* build array of known_hosts
* @param knownHosts known_hosts