From 58f6b769b490806c38baf62a580dfa080da447cd Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 3 Jul 2024 13:32:33 +0100 Subject: [PATCH 1/2] fix: Comment works correctly for failed test --- src/main.ts | 2 +- src/scripts/comment.ts | 2 +- src/scripts/runTests.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 9d3e478..b4b3216 100644 --- a/src/main.ts +++ b/src/main.ts @@ -20,7 +20,7 @@ const run = async () => { const analyzeStr: stepResponse = await getAnalyze(); const testStr: stepResponse = await getTest(); - const coverageStr: stepResponse = await getCoverage(oldCoverage); + const coverageStr: stepResponse = getCoverage(oldCoverage); const comment = createComment(analyzeStr, testStr, coverageStr, behindByStr); diff --git a/src/scripts/comment.ts b/src/scripts/comment.ts index 8798115..f80b358 100644 --- a/src/scripts/comment.ts +++ b/src/scripts/comment.ts @@ -18,7 +18,7 @@ export const createComment = (
  • ✅ - Linting / Formatting
  • ${analyze.output.replaceAll("`|\"|'|<|>", "")}
  • ${test.output.replaceAll("`|\"|'|<|>", "")}
  • - ${isSuccess ? "
  • ✅ - Branch is not behind" : null} + ${isSuccess ? "
  • ✅ - Branch is not behind
  • " : ""}
  • ${coverage.output.replaceAll("`|\"|'|<|>", "")}
  • diff --git a/src/scripts/runTests.ts b/src/scripts/runTests.ts index cbad047..25926a8 100644 --- a/src/scripts/runTests.ts +++ b/src/scripts/runTests.ts @@ -75,7 +75,8 @@ export const getTest = async (): Promise => { } else if (entry4) { testDetails = entry4.error; } - + testDetails = testDetails.replace(/(?:\r\n|\r|\n)/g, "
    "); + testDetails = testDetails.replace(/(?:<>'"`)/g, ""); errorString.push("
    " + testName + "
    `" + testDetails + "`
    "); }); From f354fd3269d77ea9ef1d8f20f380c3848824f5b3 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 3 Jul 2024 12:34:17 +0000 Subject: [PATCH 2/2] ci(automated commit): Build bundled file --- dist/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1f8f232..90d0b50 100644 --- a/dist/index.js +++ b/dist/index.js @@ -30564,7 +30564,7 @@ const createComment = (analyze, test, coverage, behindBy) => {
  • ✅ - Linting / Formatting
  • ${analyze.output.replaceAll("`|\"|'|<|>", "")}
  • ${test.output.replaceAll("`|\"|'|<|>", "")}
  • - ${isSuccess ? "
  • ✅ - Branch is not behind" : null} + ${isSuccess ? "
  • ✅ - Branch is not behind
  • " : ""}
  • ${coverage.output.replaceAll("`|\"|'|<|>", "")}
  • @@ -30809,6 +30809,8 @@ const getTest = async () => { else if (entry4) { testDetails = entry4.error; } + testDetails = testDetails.replace(/(?:\r\n|\r|\n)/g, "
    "); + testDetails = testDetails.replace(/(?:<>'"`)/g, ""); errorString.push("
    " + testName + "
    `" + testDetails + "`
    "); }); const output = `⛔️ - ${initialString}
    @@ -33151,7 +33153,7 @@ const run = async () => { const oldCoverage = (0, coverage_1.getOldCoverage)(); const analyzeStr = await (0, analyze_1.getAnalyze)(); const testStr = await (0, runTests_1.getTest)(); - const coverageStr = await (0, coverage_1.getCoverage)(oldCoverage); + const coverageStr = (0, coverage_1.getCoverage)(oldCoverage); const comment = (0, comment_1.createComment)(analyzeStr, testStr, coverageStr, behindByStr); (0, comment_1.postComment)(octokit, comment, github_1.context); await (0, push_1.push)();