8000 Add max-attempts input by dhawalseth · Pull Request #293 · actions/download-artifact · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add max-attempts input #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
8000
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions src/download-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async function run(): Promise<void> {
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})
Expand Down Expand Up @@ -55,6 +56,14 @@ async function run(): Promise<void> {
}
}

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) {
Expand Down
0