Skip to content

Commit

Permalink
check for undefined in promiseWhile.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
JKobrynski committed Apr 8, 2024
1 parent ce06355 commit 723014d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
5 changes: 5 additions & 0 deletions .github/libs/promiseWhile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ function promiseDoWhile(condition: () => boolean, action: (() => Promise<void>)
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())
Expand Down

0 comments on commit 723014d

Please sign in to comment.