Skip to content

Commit 0a0d38f

Browse files
committed
Fix error state check
1 parent 6629665 commit 0a0d38f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ const waitForDeploy = async ({ siteId, sha }) => {
4343
if (currentDeploy.state === 'ready') {
4444
console.log('deploy is ready');
4545
return currentDeploy;
46-
} else if (currentDeploy.state === 'failed') {
46+
} else if (currentDeploy.state === 'error') {
47+
console.log('deploy failed');
4748
return null;
4849
} else {
49-
await new Promise((r) => setTimeout(r, 2000));
50+
await new Promise((r) => setTimeout(r, 10000));
5051
return waitForDeploy({ siteId, sha });
5152
}
5253
} else {
@@ -55,15 +56,15 @@ const waitForDeploy = async ({ siteId, sha }) => {
5556
};
5657

5758
const waitForLive = async ({ siteId, sha, MAX_TIMEOUT }) => {
58-
const iterations = MAX_TIMEOUT / 2;
59+
const iterations = MAX_TIMEOUT / 10;
5960
let currentDeploy = null;
6061
for (let i = 0; i < iterations; i++) {
6162
try {
6263
currentDeploy = await getCurrentDeploy({ siteId, sha });
6364
if (currentDeploy) {
6465
break;
6566
} else {
66-
await new Promise((r) => setTimeout(r, 2000));
67+
await new Promise((r) => setTimeout(r, 10000));
6768
}
6869
} catch (e) {
6970
console.log(e);
@@ -102,7 +103,7 @@ const run = async () => {
102103
}
103104

104105
const MAX_TIMEOUT = Number(core.getInput('max_timeout')) || 120;
105-
106+
console.log(`Max timeout: ${MAX_TIMEOUT}s`);
106107
const sha = github.context.payload.pull_request
107108
? github.context.payload.pull_request.head.sha
108109
: github.context.payload.head_commit.id;

0 commit comments

Comments
 (0)