Skip to content

Commit

Permalink
fix: escape %
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Nov 13, 2024
1 parent c2cb85a commit 77abf1e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dist/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -19980,7 +19980,7 @@ function formatCoverage(coverage) {
if (coverage > 0.8) color = "orange";
if (coverage > 0.95) color = "lightgreen";
if (coverage === 1) color = "green";
return "{\\color{" + color + "}" + percent + "\\%}";
return "{\\color{" + color + "}" + percent + "%}";
}
var UP = `\u2191`;
var DOWN = `\u2193`;
Expand All @@ -19991,7 +19991,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) {
if (diff)
formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", {
maximumSignificantDigits: 2
}).format(diff) + "\\%" + formattedString;
}).format(diff) + "%" + formattedString;
return `$${formattedString}$<br />$${hit} / ${found}$`;
}
function findFile(report, file) {
Expand Down Expand Up @@ -20052,7 +20052,7 @@ async function main() {
"report",
`<details><summary>:crystal_ball: <strong>Coverage report</strong></summary>

${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$")}
${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/\%/g, "\\%")}

</details>`
);
Expand Down
6 changes: 3 additions & 3 deletions dist/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19985,7 +19985,7 @@ function formatCoverage(coverage) {
if (coverage > 0.8) color = "orange";
if (coverage > 0.95) color = "lightgreen";
if (coverage === 1) color = "green";
return "{\\color{" + color + "}" + percent + "\\%}";
return "{\\color{" + color + "}" + percent + "%}";
}
var UP = `\u2191`;
var DOWN = `\u2193`;
Expand All @@ -19996,7 +19996,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) {
if (diff)
formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", {
maximumSignificantDigits: 2
}).format(diff) + "\\%" + formattedString;
}).format(diff) + "%" + formattedString;
return `$${formattedString}$<br />$${hit} / ${found}$`;
}
function findFile(report, file) {
Expand Down Expand Up @@ -20057,7 +20057,7 @@ async function main() {
"report",
`<details><summary>:crystal_ball: <strong>Coverage report</strong></summary>

${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$")}
${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/\%/g, "\\%")}

</details>`
);
Expand Down
4 changes: 2 additions & 2 deletions dist/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function formatCoverage(coverage) {
if (coverage > 0.8) color = "orange";
if (coverage > 0.95) color = "lightgreen";
if (coverage === 1) color = "green";
return "{\\color{" + color + "}" + percent + "\\%}";
return "{\\color{" + color + "}" + percent + "%}";
}
var UP = `\u2191`;
var DOWN = `\u2193`;
Expand All @@ -42,7 +42,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) {
if (diff)
formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", {
maximumSignificantDigits: 2
}).format(diff) + "\\%" + formattedString;
}).format(diff) + "%" + formattedString;
return `$${formattedString}$<br />$${hit} / ${found}$`;
}
function findFile(report, file) {
Expand Down
4 changes: 2 additions & 2 deletions dist/lib.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function formatCoverage(coverage) {
if (coverage > 0.8) color = "orange";
if (coverage > 0.95) color = "lightgreen";
if (coverage === 1) color = "green";
return "{\\color{" + color + "}" + percent + "\\%}";
return "{\\color{" + color + "}" + percent + "%}";
}
var UP = `\u2191`;
var DOWN = `\u2193`;
Expand All @@ -18,7 +18,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) {
if (diff)
formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", {
maximumSignificantDigits: 2
}).format(diff) + "\\%" + formattedString;
}).format(diff) + "%" + formattedString;
return `$${formattedString}$<br />$${hit} / ${found}$`;
}
function findFile(report, file) {
Expand Down
2 changes: 1 addition & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function main() {

setOutput(
"report",
`<details><summary>:crystal_ball: <strong>Coverage report</strong></summary>\n\n${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$")}\n\n</details>`,
`<details><summary>:crystal_ball: <strong>Coverage report</strong></summary>\n\n${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/\%/g, "\\%")}\n\n</details>`,
);
}
main();
4 changes: 2 additions & 2 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function formatCoverage(coverage: number) {
if (coverage > 0.8) color = "orange";
if (coverage > 0.95) color = "lightgreen";
if (coverage === 1) color = "green";
return "{\\color{" + color + "}" + percent + "\\%}";
return "{\\color{" + color + "}" + percent + "%}";
}

type GetCoverageLineParams = {
Expand All @@ -35,7 +35,7 @@ function formatCoverageLine(
new Intl.NumberFormat("en-US", {
maximumSignificantDigits: 2,
}).format(diff) +
"\\%" +
"%" +
formattedString;

return `$${formattedString}$<br />$${hit} / ${found}$`;
Expand Down

0 comments on commit 77abf1e

Please sign in to comment.