mirror of
https://github.com/deployphp/action.git
synced 2025-06-28 20:24:14 +00:00
parent
4b3c564869
commit
ad4e7856ef
3 changed files with 17 additions and 5 deletions
13
index.js
13
index.js
|
@ -26,12 +26,17 @@ function ssh() {
|
|||
let privateKey = core.getInput('private-key').replace('/\r/g', '').trim() + '\n'
|
||||
execa.sync('ssh-add', ['-'], {input: privateKey})
|
||||
|
||||
let knownHosts = core.getInput('known-hosts')
|
||||
if (knownHosts === '') {
|
||||
fs.appendFileSync(`${ssh}/config`, `StrictHostKeyChecking no`)
|
||||
} else {
|
||||
const knownHosts = core.getInput('known-hosts')
|
||||
if (knownHosts !== '') {
|
||||
fs.appendFileSync(`${ssh}/known_hosts`, knownHosts)
|
||||
fs.chmodSync(`${ssh}/known_hosts`, '644')
|
||||
} else {
|
||||
fs.appendFileSync(`${ssh}/config`, `StrictHostKeyChecking no`)
|
||||
}
|
||||
|
||||
const sshConfig = core.getInput('ssh-config')
|
||||
if (sshConfig !== '') {
|
||||
fs.writeFile(`${ssh}/config`, sshConfig)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue