From b819e6af2982578b73fa6fbc793a91ef1a0d6fc6 Mon Sep 17 00:00:00 2001 From: David Hiendl Date: Tue, 5 Dec 2023 11:15:02 +0100 Subject: [PATCH] use ACTIONS_STEP_DEBUG to determine debug mode, use isTrueString lib function --- src/action.js | 4 ++-- src/lib.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/action.js b/src/action.js index a01fb50..3fa344c 100644 --- a/src/action.js +++ b/src/action.js @@ -5,6 +5,7 @@ import { addCiRegistryAuth, collectTags, executeDockerBuild, + isTrueString, mergeArgRegistryAuthJson, prepareDestinations, prepareDockerArgs, @@ -16,8 +17,7 @@ import { try { const information = action_information.collect_all(true, false); - const debug = process.env['ACTIONS_STEP_DEBUG'] === '1' || process.env['ACTIONS_STEP_DEBUG'] === 'true'; - console.log('debug=', debug); + const debug = isTrueString(process.env['ACTIONS_STEP_DEBUG']); let targetRegistries = []; const repoStr = github.context.repo.owner + '/' + github.context.repo.repo; diff --git a/src/lib.js b/src/lib.js index d35de81..8e19b88 100644 --- a/src/lib.js +++ b/src/lib.js @@ -230,3 +230,10 @@ export function executeDockerBuild(dockerArgs, destinations) { throw proc.error; } } + +export function isTrueString(str) { + return str === '1' + || str === 'true' + || str === 'True' + || str === 'TRUE'; +}