From 81f2a1577801008c9af2183e2e42d036e822e1cb Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sun, 6 Dec 2020 16:54:45 +0100 Subject: [PATCH] post: check if file exists before unlinking --- post.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/post.js b/post.js index b5441ba..0c149e2 100644 --- a/post.js +++ b/post.js @@ -2,8 +2,10 @@ const core = require('@actions/core') const fs = require('fs') function rm(file) { - core.info(`==> Deleting "${file}" file`) - fs.unlinkSync(file) + if (fs.existsSync(file)) { + core.info(`==> Deleting "${file}" file`) + fs.unlinkSync(file) + } } async function main() {