From 9dde5949a8581ffa4b332319119403d395d953b4 Mon Sep 17 00:00:00 2001 From: Henri Maurer Date: Wed, 7 Jun 2023 16:39:16 +0100 Subject: [PATCH] retry every 10s --- src/main.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.ts b/src/main.ts index 32228d1..c6f9f6c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,26 +29,27 @@ async function run(): Promise { let changes let snapshot_warnings - for (let i = 0; i < 60 * 5; i++) { + let i = 0 + while (true) { const comparison = await dependencyGraph.compare({ owner: github.context.repo.owner, repo: github.context.repo.repo, baseRef: refs.base, headRef: refs.head }) - if ( - comparison.snapshot_warnings.match( - /No snapshots were found for the head SHA/i - ) - ) { + if (i >= 12) { + core.setFailed('Exhausted retries. Exiting.') + return + } else if (comparison.snapshot_warnings.trim() != '') { core.info(comparison.snapshot_warnings) - core.info('Retrying in 1 second...') - await delay(1000) + core.info('Retrying in 10 seconds...') + await delay(10000) } else { changes = comparison.changes snapshot_warnings = comparison.snapshot_warnings break } + i++ } if (!changes) {