From b3bcba9d257a99691e2de45adbcfeefa0871e87d Mon Sep 17 00:00:00 2001 From: David Finol Date: Mon, 22 Feb 2021 22:27:55 -0600 Subject: [PATCH] Add createCheck to display test results in GitHub UI --- action/entrypoint.sh | 2 ++ src/index.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/action/entrypoint.sh b/action/entrypoint.sh index 6a68541..6d4eed5 100644 --- a/action/entrypoint.sh +++ b/action/entrypoint.sh @@ -29,4 +29,6 @@ fi; # Exit with code from the build step. # +if [ $USE_EXIT_CODE = true ]; then exit $TEST_RUNNER_EXIT_CODE +fi; diff --git a/src/index.js b/src/index.js index cfd91da..2e338ff 100644 --- a/src/index.js +++ b/src/index.js @@ -30,16 +30,20 @@ async function action() { testMode, artifactsPath, useHostNetwork, + createCheck, customParameters, }); - - if (createCheck) { - await ResultsCheck.publishResults(artifactsPath, githubToken); - } } finally { // Set output await Output.setArtifactsPath(artifactsPath); } + + if (createCheck) { + const fail = await ResultsCheck.publishResults(artifactsPath, githubToken); + if (fail > 0) { + core.setFailed('Tests Failed! See Test Results for details.'); + } + } } action().catch(error => {