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:
parent
3030f9c5d9
commit
4f9c73a958
1 changed files with 27 additions and 3 deletions
30
lib/index.js
30
lib/index.js
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue