From b037bcc8a83657c9bdbf5232b798d1051d446987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Hollander?= Date: Fri, 16 Dec 2022 23:08:08 +0100 Subject: [PATCH] chore: update lib (#172) --- lib/index.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/index.js b/lib/index.js index 70f6919b..5a490ef0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -9555,20 +9555,18 @@ async function run() { const reactions = core.getInput('reactions'); const mode = core.getInput('mode'); if (!message && !filePath) { - core.setFailed('Either "filePath" or "message" input should be provided'); + core.setFailed('Either "filePath" or "message" should be provided as input'); return; } let content = message; - let _filePath = filePath; + let _filePath; if (!message && filePath) { - if (!path_1.default.isAbsolute(filePath)) { - const { GITHUB_WORKSPACE } = process.env; - if (!GITHUB_WORKSPACE) { - core.setFailed('GITHUB_WORKSPACE env variable should be defined because the "filePath" provided is relative.'); - return; - } - _filePath = path_1.default.join(GITHUB_WORKSPACE, filePath); + const { GITHUB_WORKSPACE } = process.env; + if (!GITHUB_WORKSPACE) { + core.setFailed('"GITHUB_WORKSPACE" env variable is not defined.'); + return; } + _filePath = path_1.default.join(GITHUB_WORKSPACE, filePath); content = fs_1.default.readFileSync(_filePath, 'utf8'); } const context = github.context;