From 5ee3274c8f6c26eba2f2153ef8a8b6e8b0d468ae Mon Sep 17 00:00:00 2001 From: ayoubensalem Date: Thu, 28 Jul 2022 13:58:29 +0100 Subject: [PATCH 1/4] retry on success as well --- action.yml | 2 +- src/index.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 7528bc4..c8f48e3 100644 --- a/action.yml +++ b/action.yml @@ -26,7 +26,7 @@ inputs: required: false default: 1 retry_on: - description: Event to retry on. Currently supported [any, timeout, error] + description: Event to retry on. Currently supported [any, timeout, error, success] warning_on_retry: description: Whether to output a warning on retry, or just output to info. Defaults to true default: true diff --git a/src/index.ts b/src/index.ts index b2fa2ff..eed1675 100644 --- a/src/index.ts +++ b/src/index.ts @@ -181,7 +181,9 @@ async function runAction() { setOutput(OUTPUT_TOTAL_ATTEMPTS_KEY, attempt); await runCmd(attempt); info(`Command completed after ${attempt} attempt(s).`); - break; + if !(RETRY_ON === 'success') { + break; + } } catch (error) { if (attempt === MAX_ATTEMPTS) { throw new Error(`Final attempt failed. ${error.message}`); From 5ae202dd92cdb8102560be4f1f62a43f11de394d Mon Sep 17 00:00:00 2001 From: Ayoub Ed-dafali Date: Thu, 28 Jul 2022 14:55:07 +0100 Subject: [PATCH 2/4] Update index.ts --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index eed1675..e261658 100644 --- a/src/index.ts +++ b/src/index.ts @@ -181,9 +181,10 @@ async function runAction() { setOutput(OUTPUT_TOTAL_ATTEMPTS_KEY, attempt); await runCmd(attempt); info(`Command completed after ${attempt} attempt(s).`); - if !(RETRY_ON === 'success') { + if (RETRY_ON !== 'success') { break; } + await retryWait(); } catch (error) { if (attempt === MAX_ATTEMPTS) { throw new Error(`Final attempt failed. ${error.message}`); From fdf3ccbb9442185e1da9b4436decfbebd6c39a66 Mon Sep 17 00:00:00 2001 From: Ayoub Ed-dafali Date: Tue, 16 Aug 2022 14:30:11 +0100 Subject: [PATCH 3/4] Update index.ts --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 8b87106..99ec9ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -127,7 +127,7 @@ async function runAction(inputs: Inputs) { break; // eslint-disable-next-line } - await retryWait(); + await retryWait(ms.seconds(inputs.retry_wait_seconds)); } catch (error: any) { if (attempt === inputs.max_attempts) { throw new Error(`Final attempt failed. ${error.message}`); From 47e0c732ea6a17b3e7726add4d68954186d174f8 Mon Sep 17 00:00:00 2001 From: Ayoub Ed-dafali Date: Tue, 16 Aug 2022 14:31:22 +0100 Subject: [PATCH 4/4] Update index.ts --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 99ec9ac..c84bec6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -123,7 +123,7 @@ async function runAction(inputs: Inputs) { setOutput(OUTPUT_TOTAL_ATTEMPTS_KEY, attempt); await runCmd(attempt, inputs); info(`Command completed after ${attempt} attempt(s).`); - if (RETRY_ON !== 'success') { + if (inputs.retry_on !== 'success') { break; // eslint-disable-next-line }