From ec7f248c651b441ad368013074e29e65e075e3c4 Mon Sep 17 00:00:00 2001 From: dmsolutionsmn Date: Wed, 7 Aug 2024 01:14:30 -0500 Subject: [PATCH] fix exitcode bug when exitcode is 2 --- dist/index1.js | 3 ++- wrapper/terraform.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/index1.js b/dist/index1.js index c6f4bdd..9f83c9f 100755 --- a/dist/index1.js +++ b/dist/index1.js @@ -27973,7 +27973,8 @@ async function checkTerraform () { core.setOutput('stderr', stderr.contents); core.setOutput('exitcode', exitCode.toString(10)); - if (exitCode === 0 || exitCode === 2) { + const usingDetailedExitcode = args.filter(arg => arg.toLowerCase().endsWith('-detailed-exitcode')).length > 0; + if (exitCode === 0 || (exitCode === 2 && usingDetailedExitcode)) { // 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 diff --git a/wrapper/terraform.js b/wrapper/terraform.js index 7350dc4..a3291f4 100755 --- a/wrapper/terraform.js +++ b/wrapper/terraform.js @@ -43,7 +43,8 @@ async function checkTerraform () { core.setOutput('stderr', stderr.contents); core.setOutput('exitcode', exitCode.toString(10)); - if (exitCode === 0 || exitCode === 2) { + const usingDetailedExitcode = args.filter(arg => arg.toLowerCase().endsWith('-detailed-exitcode')).length > 0; + if (exitCode === 0 || (exitCode === 2 && usingDetailedExitcode)) { // 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