1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2024-11-23 00:49:42 +00:00
action-ansible-playbook/post.js

40 lines
898 B
JavaScript
Raw Permalink Normal View History

2020-05-07 09:41:40 +00:00
const core = require('@actions/core')
const fs = require('fs')
function rm(file) {
if (fs.existsSync(file)) {
core.info(`==> Deleting "${file}" file`)
fs.unlinkSync(file)
}
2020-05-07 09:41:40 +00:00
}
async function main() {
try {
2020-05-14 18:16:43 +00:00
const directory = core.getState("directory")
2020-05-07 09:41:40 +00:00
const keyFile = core.getState("keyFile")
const inventoryFile = core.getState("inventoryFile")
const vaultPasswordFile = core.getState("vaultPasswordFile")
const knownHostsFile = core.getState("knownHostsFile")
2020-05-07 09:41:40 +00:00
2020-05-14 18:16:43 +00:00
if (directory)
process.chdir(directory)
2020-05-07 09:41:40 +00:00
if (keyFile)
rm(keyFile)
if (inventoryFile)
rm(inventoryFile)
if (vaultPasswordFile)
rm(vaultPasswordFile)
if (knownHostsFile)
rm(knownHostsFile)
2020-05-07 09:41:40 +00:00
} catch (error) {
core.setFailed(error.message)
}
}
main()