Skip to content

Commit

Permalink
chore: update lib (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
thollander committed Dec 16, 2022
1 parent e55342f commit b037bcc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b037bcc

Please sign in to comment.