mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-25 01:48:55 +00:00
34 lines
774 B
JavaScript
34 lines
774 B
JavaScript
const core = require('@actions/core')
|
|
const fs = require('fs')
|
|
|
|
function rm(file) {
|
|
if (fs.existsSync(file)) {
|
|
core.info(`==> Deleting "${file}" file`)
|
|
fs.unlinkSync(file)
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
try {
|
|
const directory = core.getState("directory")
|
|
const keyFile = core.getState("keyFile")
|
|
const inventoryFile = core.getState("inventoryFile")
|
|
const vaultPasswordFile = core.getState("vaultPasswordFile")
|
|
|
|
if (directory)
|
|
process.chdir(directory)
|
|
|
|
if (keyFile)
|
|
rm(keyFile)
|
|
|
|
if (inventoryFile)
|
|
rm(inventoryFile)
|
|
|
|
if (vaultPasswordFile)
|
|
rm(vaultPasswordFile)
|
|
} catch (error) {
|
|
core.setFailed(error.message)
|
|
}
|
|
}
|
|
|
|
main()
|