From b8fe923df23e334588460f0e263d3493b9ae8a9d Mon Sep 17 00:00:00 2001 From: dhawalseth Date: Wed, 7 Feb 2024 14:18:31 -0800 Subject: [PATCH 1/3] Add max-attempts input --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 54a3eb6..a38a77e 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: pattern: description: 'A glob pattern matching the artifacts that should be downloaded. Ignored if name is specified.' required: false + max-attempts: + description: 'Maximum number of attempts while retrying download.' + required: false + default: '5' merge-multiple: description: 'When multiple artifacts are matched, this changes the behavior of the destination directories. If true, the downloaded artifacts will be in the same directory specified by path. From 8371d5fae11fc5a3cb6da240c7d30fec594233cf Mon Sep 17 00:00:00 2001 From: dhawalseth Date: Wed, 7 Feb 2024 14:21:51 -0800 Subject: [PATCH 2/3] Update download-artifact.ts --- src/download-artifact.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/download-artifact.ts b/src/download-artifact.ts index aedfe12..17ddc77 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -21,6 +21,7 @@ async function run(): Promise { path: core.getInput(Inputs.Path, {required: false}), token: core.getInput(Inputs.GitHubToken, {required: false}), repository: core.getInput(Inputs.Repository, {required: false}), + maxAttempts: core.getInput(constants_1.Inputs.MaxAttempts, { required: false }), runID: parseInt(core.getInput(Inputs.RunID, {required: false})), pattern: core.getInput(Inputs.Pattern, {required: false}), mergeMultiple: core.getBooleanInput(Inputs.MergeMultiple, {required: false}) @@ -55,6 +56,14 @@ async function run(): Promise { } } + if (inputs.maxAttempts) { + core.info(`Max attempts for retrying download: ${inputs.maxAttempts}`); + options.findBy["maxAttempts"] = inputs.maxAttempts; + } + else { + throw new Error(`Invalid retryCount: '${inputs.maxAttempts}'. Must be greater than 0`); + } + let artifacts: Artifact[] = [] if (isSingleArtifactDownload) { From f53197c6b4798b5c57e5a1aa190934ecd6ceb311 Mon Sep 17 00:00:00 2001 From: dhawalseth Date: Wed, 7 Feb 2024 14:22:13 -0800 Subject: [PATCH 3/3] Update constants.ts --- src/constants.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 17c7d34..bb7cbff 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -5,7 +5,8 @@ export enum Inputs { Repository = 'repository', RunID = 'run-id', Pattern = 'pattern', - MergeMultiple = 'merge-multiple' + MergeMultiple = 'merge-multiple', + MaxAttempts = 'max-attempts' } export enum Outputs {