mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
use known_hosts: no
instead of no_known_hosts: true
This commit is contained in:
parent
712085029d
commit
c31b1e4544
8 changed files with 10 additions and 64 deletions
26
lib/index.js
26
lib/index.js
|
@ -428,13 +428,12 @@ const core = __importStar(__nccwpck_require__(186));
|
|||
function main() {
|
||||
try {
|
||||
// parameters
|
||||
const noKnownHosts = string2boolean(core.getInput("no_known_hosts"));
|
||||
const key = core.getInput("key", {
|
||||
required: true,
|
||||
});
|
||||
const name = core.getInput("name");
|
||||
const knownHosts = core.getInput("known_hosts", {
|
||||
required: !noKnownHosts, // optional if no_known_hosts is true
|
||||
required: true,
|
||||
});
|
||||
const config = core.getInput("config");
|
||||
const ifKeyExists = core.getInput("if_key_exists");
|
||||
|
@ -457,7 +456,7 @@ function main() {
|
|||
},
|
||||
});
|
||||
}
|
||||
if (knownHosts !== "") {
|
||||
if (knownHosts !== "no") {
|
||||
files.push({
|
||||
name: "known_hosts",
|
||||
contents: insertLf(knownHosts, true, true),
|
||||
|
@ -488,27 +487,6 @@ function main() {
|
|||
core.setFailed(err.message);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* convert string to boolean
|
||||
* @param value string value
|
||||
* @returns boolean value
|
||||
*/
|
||||
function string2boolean(value) {
|
||||
// true if "true" / "yes" / "on"
|
||||
switch (value.trim().toLowerCase()) {
|
||||
case "true":
|
||||
case "yes":
|
||||
case "on":
|
||||
return true;
|
||||
}
|
||||
// true if number and non-zero
|
||||
const numberValue = Number(value);
|
||||
if (!isNaN(numberValue) && numberValue !== 0) {
|
||||
return true;
|
||||
}
|
||||
// false otherwise
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* get home directory
|
||||
* @returns home directory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue