Skip to content

Commit

Permalink
(fix): check base-file exists before reading it
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassabreu committed Aug 16, 2021
1 parent 1f04ddf commit 072da0c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bin/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/index.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getInput } from "@actions/core";
import { getOctokit } from "@actions/github";
import { context } from "@actions/github/lib/utils";
import { readFile } from "fs";
import { readFile, existsSync } from "fs";
import { promisify } from "util";
import { fromString } from "./clover";
import { html } from "./html";
Expand All @@ -28,6 +28,7 @@ const comment = async (file: string, baseFile?: string) => {

const oldStats =
baseFile &&
existsSync(baseFile) &&
fromString((await promisify(readFile)(baseFile)).toString(), onlyWithCover);

const w = workspace.endsWith("/") ? workspace : workspace.concat("/");
Expand Down

0 comments on commit 072da0c

Please sign in to comment.