diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 4b76cc962968..1cb7934cfb91 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12754,9 +12754,13 @@ function promiseDoWhile(condition, action) { console.info('[promiseWhile] promiseDoWhile() condition', condition); const actionResult = action?.(); console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); + 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 7e15b6d69009..2fc53c34fec3 100644 --- a/.github/libs/promiseWhile.ts +++ b/.github/libs/promiseWhile.ts @@ -30,9 +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) { + resolve(); + return; + } + actionResult - ?.then(() => promiseWhile(condition, action)) - .then(() => resolve()) + .then(() => promiseWhile(condition, action)) + .then(resolve) .catch(reject); }); }