diff --git a/.github/actions/javascript/awaitStagingDeploys/awaitStagingDeploys.ts b/.github/actions/javascript/awaitStagingDeploys/awaitStagingDeploys.ts index 958a643d4287..1cf58dc03f8f 100644 --- a/.github/actions/javascript/awaitStagingDeploys/awaitStagingDeploys.ts +++ b/.github/actions/javascript/awaitStagingDeploys/awaitStagingDeploys.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import lodashThrottle from 'lodash/throttle'; -import ActionUtils from '@github/libs/ActionUtils'; +import {getStringInput} from '@github/libs/ActionUtils'; import CONST from '@github/libs/CONST'; import GitHubUtils, {POLL_RATE} from '@github/libs/GithubUtils'; import {promiseDoWhile} from '@github/libs/promiseWhile'; @@ -9,11 +9,11 @@ type CurrentStagingDeploys = Awaited boolean, action: () => Promise): Promise { +function promiseWhile(condition: () => boolean, action: (() => Promise) | DebouncedFunc<() => Promise> | undefined): Promise { console.info('[promiseWhile] promiseWhile()'); return new Promise((resolve, reject) => { @@ -9,7 +11,7 @@ function promiseWhile(condition: () => boolean, action: () => Promise): Pr if (!condition()) { resolve(); } else { - const actionResult = action(); + const actionResult = action?.(); console.info('[promiseWhile] promiseWhile() actionResult', actionResult); Promise.resolve(actionResult).then(loop).catch(reject); } @@ -21,15 +23,15 @@ function promiseWhile(condition: () => boolean, action: () => Promise): Pr /** * Simulates a do-while loop where the condition is determined by the result of a Promise. */ -function promiseDoWhile(condition: () => boolean, action: () => Promise): Promise { +function promiseDoWhile(condition: () => boolean, action: (() => Promise) | DebouncedFunc<() => Promise> | undefined): Promise { console.info('[promiseWhile] promiseDoWhile()'); return new Promise((resolve, reject) => { console.info('[promiseWhile] promiseDoWhile() condition', condition); - const actionResult = action(); + const actionResult = action?.(); console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); actionResult - .then(() => promiseWhile(condition, action)) + ?.then(() => promiseWhile(condition, action)) .then(() => resolve()) .catch(reject); });