Skip to content

Commit

Permalink
Fix boolean parameters being passed in as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
andybelltree committed Nov 21, 2021
1 parent f9a9d65 commit 6d980f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 7 additions & 9 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22831,17 +22831,16 @@ function filterAndNormaliseLcov(lcov, options) {
return lcov
.map(file => ({
...file,
file: normalisePath(file.file)
file: normalisePath(file.file),
}))
.filter(file =>
shouldBeIncluded(file.file, options))
.filter(file => shouldBeIncluded(file.file, options))
}

function shouldBeIncluded(fileName, options) {
if (!options.shouldFilterChangedFiles) {
return true
}
return options.changedFiles.includes(fileName.replace(options.prefix, ""));
return options.changedFiles.includes(fileName.replace(options.prefix, ""))
}

function toFolder(path) {
Expand Down Expand Up @@ -23083,7 +23082,7 @@ async function getExistingComments(github, options, context) {
return results.filter(
comment =>
!!comment.user &&
(!options.title || comment.body.includes(options.title)) &&
(!options.title || comment.body.includes(options.title)) &&
comment.body.includes("Coverage Report"),
)
}
Expand All @@ -23095,8 +23094,8 @@ async function main$1() {
const githubClient = new github_2(token);
const lcovFile = core$1.getInput("lcov-file") || "./coverage/lcov.info";
const baseFile = core$1.getInput("lcov-base");
const shouldFilterChangedFiles = core$1.getInput("filter-changed-files");
const shouldDeleteOldComments = core$1.getInput("delete-old-comments");
const shouldFilterChangedFiles = core$1.getInput("filter-changed-files").toLowerCase() === 'true';
const shouldDeleteOldComments = core$1.getInput("delete-old-comments").toLowerCase() === 'true';
const title = core$1.getInput("title");

const raw = await fs.promises.readFile(lcovFile, "utf-8").catch(err => null);
Expand Down Expand Up @@ -23136,8 +23135,7 @@ async function main$1() {

const lcov = await parse$2(raw);
const baselcov = baseRaw && (await parse$2(baseRaw));
const body = diff(lcov, baselcov, options)
.substring(0, MAX_COMMENT_CHARS);
const body = diff(lcov, baselcov, options).substring(0, MAX_COMMENT_CHARS);

if (shouldDeleteOldComments) {
await deleteOldComments(githubClient, options, github_1);
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ async function main() {
const githubClient = new GitHub(token)
const lcovFile = core.getInput("lcov-file") || "./coverage/lcov.info"
const baseFile = core.getInput("lcov-base")
const shouldFilterChangedFiles = core.getInput("filter-changed-files")
const shouldDeleteOldComments = core.getInput("delete-old-comments")
const shouldFilterChangedFiles =
core.getInput("filter-changed-files").toLowerCase() === "true"
const shouldDeleteOldComments =
core.getInput("delete-old-comments").toLowerCase() === "true"
const title = core.getInput("title")

const raw = await fs.readFile(lcovFile, "utf-8").catch(err => null)
Expand Down

0 comments on commit 6d980f3

Please sign in to comment.