From 723014d202f85f6b76e7951e0dec3e1e6c67b60e Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 8 Apr 2024 17:15:28 +0200 Subject: [PATCH 1/2] check for undefined in promiseWhile.ts --- .github/actions/javascript/awaitStagingDeploys/index.js | 3 +++ .github/libs/promiseWhile.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 4b76cc962968..4238fd7bd689 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12754,6 +12754,9 @@ function promiseDoWhile(condition, action) { console.info('[promiseWhile] promiseDoWhile() condition', condition); const actionResult = action?.(); console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); + if (actionResult === undefined) { + resolve(); + } actionResult ?.then(() => promiseWhile(condition, action)) .then(() => resolve()) diff --git a/.github/libs/promiseWhile.ts b/.github/libs/promiseWhile.ts index 7e15b6d69009..ab936eb48648 100644 --- a/.github/libs/promiseWhile.ts +++ b/.github/libs/promiseWhile.ts @@ -30,6 +30,11 @@ function promiseDoWhile(condition: () => boolean, action: (() => Promise) console.info('[promiseWhile] promiseDoWhile() condition', condition); const actionResult = action?.(); console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); + + if (actionResult === undefined) { + resolve(); + } + actionResult ?.then(() => promiseWhile(condition, action)) .then(() => resolve()) From 632926fbc4a7d6f1fcb08306700c8a6503b6e86e Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 8 Apr 2024 20:37:03 +0200 Subject: [PATCH 2/2] adjust the code --- .github/actions/javascript/awaitStagingDeploys/index.js | 7 ++++--- .github/libs/promiseWhile.ts | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 4238fd7bd689..1cb7934cfb91 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12754,12 +12754,13 @@ function promiseDoWhile(condition, action) { console.info('[promiseWhile] promiseDoWhile() condition', condition); const actionResult = action?.(); console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); - if (actionResult === undefined) { + if (!actionResult) { resolve(); + return; } actionResult - ?.then(() => promiseWhile(condition, action)) - .then(() => resolve()) + .then(() => promiseWhile(condition, action)) + .then(resolve) .catch(reject); }); } diff --git a/.github/libs/promiseWhile.ts b/.github/libs/promiseWhile.ts index ab936eb48648..2fc53c34fec3 100644 --- a/.github/libs/promiseWhile.ts +++ b/.github/libs/promiseWhile.ts @@ -30,14 +30,14 @@ function promiseDoWhile(condition: () => boolean, action: (() => Promise) console.info('[promiseWhile] promiseDoWhile() condition', condition); const actionResult = action?.(); console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); - - if (actionResult === undefined) { + if (!actionResult) { resolve(); + return; } actionResult - ?.then(() => promiseWhile(condition, action)) - .then(() => resolve()) + .then(() => promiseWhile(condition, action)) + .then(resolve) .catch(reject); }); }