post: check if file exists before unlinking

This commit is contained in:
Dawid Dziurla 2020-12-06 16:54:45 +01:00
parent 145a900758
commit 81f2a15778
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

View File

@ -2,9 +2,11 @@ const core = require('@actions/core')
const fs = require('fs') const fs = require('fs')
function rm(file) { function rm(file) {
if (fs.existsSync(file)) {
core.info(`==> Deleting "${file}" file`) core.info(`==> Deleting "${file}" file`)
fs.unlinkSync(file) fs.unlinkSync(file)
} }
}
async function main() { async function main() {
try { try {