From 740815773b3229d8c28c2196c52c85c9a8d7942a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Peixoto?= Date: Sat, 16 Oct 2021 11:11:44 +0100 Subject: [PATCH] fixing status code 0 handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rogério Peixoto --- .github/workflows/test_action.yaml | 2 +- dist/index.js | 8 ++++++-- src/main.js | 4 ++++ src/scanner.js | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_action.yaml b/.github/workflows/test_action.yaml index 4c2bf07..a6a76a5 100644 --- a/.github/workflows/test_action.yaml +++ b/.github/workflows/test_action.yaml @@ -19,7 +19,7 @@ jobs: verbose: true output_path: myoutput/ output_formats: sarif - ignore_on_exit: results + ignore_on_exit: errors enable_comments: true - run: ls -la && ls -la myoutput if: always() diff --git a/dist/index.js b/dist/index.js index fbfcb7f..1beb159 100644 --- a/dist/index.js +++ b/dist/index.js @@ -18063,8 +18063,8 @@ async function scanWithKICS(enableComments) { resultsFile = './results.json'; } else { const outputFormats = core.getInput('output_formats'); - if (!outputFormats.toLowerCase().indexOf('json')) { - cmdArgs.push('--output-formats'); + if (outputFormats.toLowerCase().indexOf('json') == -1) { + cmdArgs.push('--report-formats'); cmdArgs.push('json'); } let resultsDir = core.getInput('output_path'); @@ -18334,6 +18334,10 @@ const exitStatus = { function setWorkflowStatus(statusCode) { console.log(`KICS scan status code: ${statusCode}`); + if (statusCode === 0) { + return; + } + const ignoreOnExit = core.getInput('ignore_on_exit'); if (ignoreOnExit.toLowerCase() === 'all') { diff --git a/src/main.js b/src/main.js index 7a53166..3325aa3 100644 --- a/src/main.js +++ b/src/main.js @@ -34,6 +34,10 @@ const exitStatus = { function setWorkflowStatus(statusCode) { console.log(`KICS scan status code: ${statusCode}`); + if (statusCode === 0) { + return; + } + const ignoreOnExit = core.getInput('ignore_on_exit'); if (ignoreOnExit.toLowerCase() === 'all') { diff --git a/src/scanner.js b/src/scanner.js index 766ea69..1446cb3 100644 --- a/src/scanner.js +++ b/src/scanner.js @@ -74,8 +74,8 @@ async function scanWithKICS(enableComments) { resultsFile = './results.json'; } else { const outputFormats = core.getInput('output_formats'); - if (!outputFormats.toLowerCase().indexOf('json')) { - cmdArgs.push('--output-formats'); + if (outputFormats.toLowerCase().indexOf('json') == -1) { + cmdArgs.push('--report-formats'); cmdArgs.push('json'); } let resultsDir = core.getInput('output_path');