From 0d224dd95f6ef203366ea22e5ff6a897f57bc917 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Tue, 17 Oct 2023 13:19:03 +1100 Subject: [PATCH] stderr fix --- README.md | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- wrapper/dist/index.js | 7 ++++--- wrapper/stackql.js | 7 ++++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b4182ef..f90dac3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/se ```yaml - name: setup StackQL - uses: stackql/setup-stackql@v1.2.0 + uses: stackql/setup-stackql@v2.0.0 with: use_wrapper: true @@ -34,7 +34,7 @@ Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/se ```yaml - name: setup StackQL - uses: stackql/setup-stackql@v1.2.0 + uses: stackql/setup-stackql@v2.0.0 with: use_wrapper: true diff --git a/package-lock.json b/package-lock.json index c732065..1927388 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "setup-stackql", - "version": "1.2.0", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "setup-stackql", - "version": "1.2.0", + "version": "2.0.0", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 0fc3725..dca0ca1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-stackql", - "version": "1.2.0", + "version": "2.0.0", "description": "", "main": "index.js", "scripts": { diff --git a/wrapper/dist/index.js b/wrapper/dist/index.js index 423ac97..c64821c 100755 --- a/wrapper/dist/index.js +++ b/wrapper/dist/index.js @@ -4208,7 +4208,7 @@ async function checkStackQL () { core.setOutput('stdout', stdout.contents); core.setOutput('stderr', stderr.contents); - if ((exitCode === 0 || exitCode === 2) && !stderr.contents) { + if (exitCode === 0 || exitCode === 2) { // A exitCode of 0 is considered a success // An exitCode of 2 may be returned when the '-detailed-exitcode' option // is passed to plan. This denotes Success with non-empty @@ -4216,8 +4216,9 @@ async function checkStackQL () { return; } - // A non-zero exitCode is considered an error - core.setFailed(`StackQL exited with error: ${stderr.contents}.`); + // If we reach this point, it means that the exitCode was neither 0 nor 2, + // which denotes an error. We can still use stderr.contents to provide more information about the error. + core.setFailed(`StackQL exited with error code ${exitCode}. Details: ${stderr.contents}.`); })(); })(); diff --git a/wrapper/stackql.js b/wrapper/stackql.js index 147db13..4f4f349 100644 --- a/wrapper/stackql.js +++ b/wrapper/stackql.js @@ -40,7 +40,7 @@ async function checkStackQL () { core.setOutput('stdout', stdout.contents); core.setOutput('stderr', stderr.contents); - if ((exitCode === 0 || exitCode === 2) && !stderr.contents) { + if (exitCode === 0 || exitCode === 2) { // A exitCode of 0 is considered a success // An exitCode of 2 may be returned when the '-detailed-exitcode' option // is passed to plan. This denotes Success with non-empty @@ -48,6 +48,7 @@ async function checkStackQL () { return; } - // A non-zero exitCode is considered an error - core.setFailed(`StackQL exited with error: ${stderr.contents}.`); + // If we reach this point, it means that the exitCode was neither 0 nor 2, + // which denotes an error. We can still use stderr.contents to provide more information about the error. + core.setFailed(`StackQL exited with error code ${exitCode}. Details: ${stderr.contents}.`); })();