(netlifyApiToken, siteId)
| 68 | } |
| 69 | |
| 70 | async function waitForDeploys(netlifyApiToken, siteId) { |
| 71 | const maxRetries = 5; |
| 72 | const retryDelayMs = 15 * 1000; // 15 seconds between retries |
| 73 | |
| 74 | for (let i = 0; i < maxRetries; i++) { |
| 75 | try { |
| 76 | const deploys = await fetchWithTimeout(netlifyApiToken, `sites/${siteId}/deploys`); |
| 77 | |
| 78 | if (deploys && deploys.some(deploy => deploy.state === 'ready')) { |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | if (i < maxRetries - 1) { |
| 83 | await new Promise(resolve => setTimeout(resolve, retryDelayMs)); |
| 84 | } |
| 85 | } catch (error) { |
| 86 | console.error(`Error checking deploy status: ${error.message}`); |
| 87 | if (i < maxRetries - 1) { |
| 88 | await new Promise(resolve => setTimeout(resolve, retryDelayMs)); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | throw new Error(`Timed out waiting for deploy of site ${siteId} after ${maxRetries * retryDelayMs / 1000}s`); |
| 94 | } |
| 95 | |
| 96 | const netlifySiteURL = 'https://fake-site-url.netlify.com/'; |
| 97 | const email = 'decap@p-m.si'; |
no test coverage detected