Skip to content

Commit

Permalink
(fix): base-file may not exist (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassabreu authored Aug 16, 2021
1 parent 072da0c commit b28b20a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
dir-prefix: /var/www/html
file: clover.example.xml
only-with-cover: true
base-file: clover.missing.xml

- name: clover file to comment (clover.example.base.xml)
uses: ./.
Expand Down
12 changes: 7 additions & 5 deletions 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.

9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ const comment = async (file: string, baseFile?: string) => {
);

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

const w = workspace.endsWith("/") ? workspace : workspace.concat("/");
cStats.folders.forEach((v, k) =>
Expand Down

0 comments on commit b28b20a

Please sign in to comment.