Skip to content

Commit

Permalink
Add support for coverage dir
Browse files Browse the repository at this point in the history
  • Loading branch information
karanshah229 committed Oct 10, 2022
1 parent 8f91993 commit f023b94
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ inputs:
description: String of files that have changed from base branch
required: false
default: ""
run_id:
description: Run id for the current action run
required: true
default: "-1"
outputs:
diff_coverage:
description: (String - Number) The coverage of this branch (%)
Expand Down
12 changes: 5 additions & 7 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23017,16 +23017,12 @@ function diff(headLcov, baseLcov, diffLcov, options) {
2,
)}%) does not meet coverage threshold (${pdiffCoverageThresholdStr}%)`;
}
const coverage_dir_link = `[Coverage directory download page link (💡 Tip: Use this if comment is clipped)](https://github.com/interviewstreet/frontend-core/actions/runs/${options.run_id})`;

return {
fragment: fragment(
options.title ? h2(options.title) : title,
options.base
? `Coverage after merging ${b(options.head)} into ${b(
options.base,
)} will be`
: `Coverage for this commit`,
// Link to download if message exceeds charcs
options.title ? h2(options.title) : h2(title),
span(coverage_dir_link),
table(
tbody(
pdiffLcov
Expand Down Expand Up @@ -23147,6 +23143,7 @@ async function main$1() {
const title = core$1.getInput("title");
const diff_threshold = parseFloat(core$1.getInput("diff_threshold")) || 0;
const files_changed = core$1.getInput("files_changed");
const run_id = parseInt(core$1.getInput("run_id"), 10) || 0;

const raw = await fs.promises.readFile(lcovFile, "utf-8").catch(err => null);
if (!raw) {
Expand All @@ -23165,6 +23162,7 @@ async function main$1() {
prefix: normalisePath(`${process.env.GITHUB_WORKSPACE}/`),
workingDir,
diffCoverageThreshold: diff_threshold,
run_id,
};

if (
Expand Down
10 changes: 3 additions & 7 deletions src/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,12 @@ export function diff(headLcov, baseLcov, diffLcov, options) {
2,
)}%) does not meet coverage threshold (${pdiffCoverageThresholdStr}%)`
}
const coverage_dir_link = `[Coverage directory download page link (💡 Tip: Use this if comment is clipped)](https://github.com/interviewstreet/frontend-core/actions/runs/${options.run_id})`

return {
fragment: fragment(
options.title ? h2(options.title) : title,
options.base
? `Coverage after merging ${b(options.head)} into ${b(
options.base,
)} will be`
: `Coverage for this commit`,
// Link to download if message exceeds charcs
options.title ? h2(options.title) : h2(title),
span(coverage_dir_link),
table(
tbody(
pdiffLcov
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function main() {
const title = core.getInput("title")
const diff_threshold = parseFloat(core.getInput("diff_threshold")) || 0
const files_changed = core.getInput("files_changed")
const run_id = parseInt(core.getInput("run_id"), 10) || 0

const raw = await fs.readFile(lcovFile, "utf-8").catch(err => null)
if (!raw) {
Expand All @@ -45,6 +46,7 @@ async function main() {
prefix: normalisePath(`${process.env.GITHUB_WORKSPACE}/`),
workingDir,
diffCoverageThreshold: diff_threshold,
run_id,
}

if (
Expand Down

0 comments on commit f023b94

Please sign in to comment.