Skip to content

Commit

Permalink
Don't try to write files when output_path is unset
Browse files Browse the repository at this point in the history
fixes #2
  • Loading branch information
wjrogers committed May 8, 2020
1 parent 39c401b commit 7e9a71c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ async function run() {
}

// write to a file
core.info(`Writing build information to ${outputFile}`);
await fs.writeFile(outputFile, JSON.stringify(build));
if (outputFile) {
core.info(`Writing build information to ${outputFile}`);
await fs.writeFile(outputFile, JSON.stringify(build));
}

// push build information to the server
if (inputs.pushPackageIds) {
Expand All @@ -321,13 +323,17 @@ async function run() {
build,
inputs.pushOverwriteMode
);
const responsePath = joinPath(
inputs.outputPath,
`buildInformationMapped-${packageId}.json`
);

core.info(`Writing mapped build information response to ${responsePath}`);
writes.push(fs.writeFile(responsePath, JSON.stringify(response)));
// write response to a file
if (inputs.outputPath) {
const responsePath = joinPath(
inputs.outputPath,
`buildInformationMapped-${packageId}.json`
);

core.info(`Writing mapped build information response to ${responsePath}`);
writes.push(fs.writeFile(responsePath, JSON.stringify(response)));
}
}

await Promise.all(writes);
Expand Down

0 comments on commit 7e9a71c

Please sign in to comment.