1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00
This commit is contained in:
shimataro 2021-03-08 18:02:01 +09:00
parent 74af40b44a
commit 91f978d590
No known key found for this signature in database
GPG key ID: BE92C05736911A9D
2 changed files with 25 additions and 22 deletions

View file

@ -446,16 +446,7 @@ function main() {
mode: 0o700,
});
// files to be created
const files = [
{
name: "config",
contents: insertLf(config, true, true),
options: {
mode: 0o644,
flag: "a",
},
},
];
const files = [];
if (shouldCreateKeyFile(path_1.default.join(dirName, name), ifKeyExists)) {
files.push({
name: name,
@ -466,7 +457,7 @@ function main() {
},
});
}
if (!noKnownHosts) {
if (knownHosts !== "") {
files.push({
name: "known_hosts",
contents: insertLf(knownHosts, true, true),
@ -476,6 +467,16 @@ function main() {
},
});
}
if (config !== "") {
files.push({
name: "config",
contents: insertLf(config, true, true),
options: {
mode: 0o644,
flag: "a",
},
});
}
// create files
for (const file of files) {
const fileName = path_1.default.join(dirName, file.name);

View file

@ -38,16 +38,7 @@ function main(): void
});
// files to be created
const files: FileInfo[] = [
{
name: "config",
contents: insertLf(config, true, true),
options: {
mode: 0o644,
flag: "a",
},
},
];
const files: FileInfo[] = [];
if(shouldCreateKeyFile(path.join(dirName, name), ifKeyExists))
{
files.push({
@ -59,7 +50,7 @@ function main(): void
},
});
}
if(!noKnownHosts)
if(knownHosts !== "")
{
files.push({
name: "known_hosts",
@ -70,6 +61,17 @@ function main(): void
},
});
}
if(config !== "")
{
files.push({
name: "config",
contents: insertLf(config, true, true),
options: {
mode: 0o644,
flag: "a",
},
});
}
// create files
for(const file of files)