mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2026-02-01 07:03:03 -07:00
* Initial plan * Convert CommonJS imports to ESM Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com> * Use namespace imports for all modules Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
import * as core from '@actions/core'
|
|
import * as fs from 'node: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 ansibleConfigurationFile = core.getState("ansibleConfigurationFile")
|
|
const keyFile = core.getState("keyFile")
|
|
const inventoryFile = core.getState("inventoryFile")
|
|
const vaultPasswordFile = core.getState("vaultPasswordFile")
|
|
const knownHostsFile = core.getState("knownHostsFile")
|
|
|
|
if (directory)
|
|
process.chdir(directory)
|
|
|
|
if (ansibleConfigurationFile)
|
|
rm(ansibleConfigurationFile)
|
|
|
|
if (keyFile)
|
|
rm(keyFile)
|
|
|
|
if (inventoryFile)
|
|
rm(inventoryFile)
|
|
|
|
if (vaultPasswordFile)
|
|
rm(vaultPasswordFile)
|
|
|
|
if (knownHostsFile)
|
|
rm(knownHostsFile)
|
|
|
|
} catch (error) {
|
|
core.setFailed(error.message)
|
|
}
|
|
}
|
|
|
|
main()
|