Skip to content

Commit

Permalink
Use getBooleanInput for update-comment argument
Browse files Browse the repository at this point in the history
Fixes vebr#21
  • Loading branch information
alexjfno1 committed Oct 5, 2021
1 parent eacce47 commit 263805a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -19,7 +19,7 @@
"format": "prettier --write src/*.js src/**/*.js"
},
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/core": "^1.6.0",
"@actions/github": "^1.1.0",
"lcov-parse": "^1.0.0"
},
Expand Down
7 changes: 6 additions & 1 deletion src/__tests__/index_test.js
Expand Up @@ -6,6 +6,7 @@ import { commentIdentifier, diff } from "../comment"

jest.mock("@actions/core", () => ({
getInput: jest.fn(),
getBooleanInput: jest.fn(),
setFailed: jest.fn(),
}))

Expand Down Expand Up @@ -39,10 +40,14 @@ beforeEach(() => {
if (arg === "name") return "NAME"
if (arg === "lcov-file") return "LCOV_FILE"
if (arg === "lcov-base") return "LCOV_BASE"
if (arg === "update-comment") return updateComment
return ""
})

core.getBooleanInput.mockImplementation(arg => {
if (arg === "update-comment") return updateComment
return false
})

context.payload.pull_request = {
base: { ref: "base-ref" },
head: { ref: "head-ref" },
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -10,7 +10,7 @@ async function main() {
const name = core.getInput("name")
const lcovFile = core.getInput("lcov-file") || "./coverage/lcov.info"
const baseFile = core.getInput("lcov-base")
const updateComment = core.getInput("update-comment")
const updateComment = core.getBooleanInput("update-comment")

const raw = await fs.readFile(lcovFile, "utf-8").catch(err => null)
if (!raw) {
Expand Down
22 changes: 18 additions & 4 deletions yarn.lock
Expand Up @@ -2,10 +2,12 @@
# yarn lockfile v1


"@actions/core@^1.2.0":
version "1.2.6"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
"@actions/core@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.6.0.tgz#0568e47039bfb6a9170393a73f3b7eb3b22462cb"
integrity sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==
dependencies:
"@actions/http-client" "^1.0.11"

"@actions/github@^1.1.0":
version "1.1.0"
Expand All @@ -15,6 +17,13 @@
"@octokit/graphql" "^2.0.1"
"@octokit/rest" "^16.15.0"

"@actions/http-client@^1.0.11":
version "1.0.11"
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.11.tgz#c58b12e9aa8b159ee39e7dd6cbd0e91d905633c0"
integrity sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==
dependencies:
tunnel "0.0.6"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
Expand Down Expand Up @@ -4510,6 +4519,11 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"

tunnel@0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==

tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
Expand Down

0 comments on commit 263805a

Please sign in to comment.