2020-05-07 09:41:40 +00:00
|
|
|
const core = require('@actions/core')
|
|
|
|
const fs = require('fs')
|
|
|
|
|
|
|
|
function rm(file) {
|
2020-12-06 15:54:45 +00:00
|
|
|
if (fs.existsSync(file)) {
|
2022-09-01 06:37:48 +00:00
|
|
|
core.info(`Deleting "${file}" file`)
|
2020-12-06 15:54:45 +00:00
|
|
|
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")
|
2024-01-17 09:06:09 +00:00
|
|
|
const ansibleConfigurationFile = core.getState("ansibleConfigurationFile")
|
2020-05-07 09:41:40 +00:00
|
|
|
const keyFile = core.getState("keyFile")
|
|
|
|
const inventoryFile = core.getState("inventoryFile")
|
|
|
|
const vaultPasswordFile = core.getState("vaultPasswordFile")
|
2021-04-04 18:51:37 +00:00
|
|
|
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)
|
2024-01-17 09:06:09 +00:00
|
|
|
|
|
|
|
if (ansibleConfigurationFile)
|
|
|
|
rm(ansibleConfigurationFile)
|
2020-05-14 18:16:43 +00:00
|
|
|
|
2020-05-07 09:41:40 +00:00
|
|
|
if (keyFile)
|
|
|
|
rm(keyFile)
|
|
|
|
|
|
|
|
if (inventoryFile)
|
|
|
|
rm(inventoryFile)
|
|
|
|
|
|
|
|
if (vaultPasswordFile)
|
|
|
|
rm(vaultPasswordFile)
|
2021-04-04 18:51:37 +00:00
|
|
|
|
|
|
|
if (knownHostsFile)
|
|
|
|
rm(knownHostsFile)
|
|
|
|
|
2020-05-07 09:41:40 +00:00
|
|
|
} catch (error) {
|
|
|
|
core.setFailed(error.message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|