├── .github ├── auto-merge.yml ├── dependabot.yml ├── labels.yml ├── workflows │ ├── release-drafter.yml │ ├── repository.yml │ └── test.yml └── release-drafter.yml ├── .yamllint ├── LICENSE.md ├── action.yml └── README.md /.github/auto-merge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | requiredLabels: 3 | - PR-merge 4 | 5 | reportStatus: true 6 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | ignore: | 5 | .yamllint 6 | 7 | 8 | rules: 9 | truthy: 10 | allowed-values: ['true', 'false'] 11 | check-keys: False 12 | level: error 13 | line-length: disable 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | labels: 9 | - "C-dependency" 10 | - "PR-merge" 11 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | # The labels in this file are automatically synced with the repository 2 | # using the micnncim/action-label-syncer action. 3 | --- 4 | - name: C-dependency 5 | color: 1abc9c 6 | description: "Category: Dependency" 7 | - name: PR-block 8 | color: 3498db 9 | description: "Pull Request: Do not merge" 10 | - name: PR-merge 11 | color: 3498db 12 | description: "Pull Request: Merge when ready" 13 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | # branches to consider in the event; optional, defaults to all 6 | branches: 7 | - master 8 | 9 | jobs: 10 | update_release_draft: 11 | runs-on: ubuntu-latest 12 | steps: 13 | # Drafts your next Release notes as Pull Requests are merged into "master" 14 | - uses: release-drafter/release-drafter@v5 15 | with: 16 | publish: true 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.RELEASE_DRAFTER_TOKEN }} 19 | -------------------------------------------------------------------------------- /.github/workflows/repository.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Repository 3 | 4 | on: 5 | push: 6 | branches: 7 | - master 8 | paths: 9 | - .github/labels.yml 10 | 11 | jobs: 12 | labels: 13 | name: Labels 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout code 18 | uses: actions/checkout@v3 19 | 20 | - name: Sync labels 21 | uses: micnncim/action-label-syncer@v1 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | with: 25 | manifest: .github/labels.yml 26 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION 🌈' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | categories: 4 | - title: '🚀 Features' 5 | labels: 6 | - 'feature' 7 | - 'enhancement' 8 | - title: '🐛 Bug Fixes' 9 | labels: 10 | - 'fix' 11 | - 'bugfix' 12 | - 'bug' 13 | - title: '🧰 Maintenance' 14 | label: 'chore' 15 | change-template: '- $TITLE @$AUTHOR (#$NUMBER)' 16 | change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. 17 | version-resolver: 18 | major: 19 | labels: 20 | - 'major' 21 | minor: 22 | labels: 23 | - 'minor' 24 | patch: 25 | labels: 26 | - 'patch' 27 | default: patch 28 | template: | 29 | ## Changes 30 | 31 | $CHANGES 32 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: test 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | test-normal: 8 | name: test-normal 9 | runs-on: ubuntu-latest 10 | steps: 11 | 12 | - name: Checkout repository 13 | uses: actions/checkout@v3 14 | with: 15 | fetch-depth: 0 16 | 17 | - name: Create artifact 18 | id: file 19 | shell: bash 20 | run: | 21 | PRE_RAND="$( ${RAND} | md5sum | head -c 20; )" 22 | PRE_DATE="$( date '+%s' )" 23 | NAME="${PRE_RAND}-${PRE_DATE}.txt" 24 | echo "somedata" > "${NAME}" 25 | echo "::set-output name=path::${NAME}" 26 | 27 | - name: upload artifact 28 | uses: cytopia/upload-artifact-retry-action@v0.1.7 29 | with: 30 | name: ${{ steps.file.outputs.path }} 31 | path: ${{ steps.file.outputs.path }} 32 | 33 | - name: download artifact 34 | uses: ./ 35 | with: 36 | name: ${{ steps.file.outputs.path }} 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | **Copyright (c) 2022 [cytopia](https://github.com/cytopia)** 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # https://help.github.com/en/articles/metadata-syntax-for-github-actions 3 | name: 'download-artifact-retry' 4 | description: "GitHub Action to download an artifact with retry functionality." 5 | author: 'cytopia' 6 | branding: 7 | icon: 'code' 8 | color: 'red' 9 | 10 | inputs: 11 | name: 12 | description: 'The artifact name to download.' 13 | required: true 14 | path: 15 | description: 'The local path to download to (defaults to current working directory).' 16 | required: false 17 | default: '.' 18 | 19 | runs: 20 | using: "composite" 21 | steps: 22 | 23 | - name: download artifact (try-1) 24 | id: download-1 25 | uses: actions/download-artifact@v3 26 | continue-on-error: true 27 | with: 28 | name: ${{ inputs.name }} 29 | path: ${{ inputs.path }} 30 | 31 | - name: download artifact (try-2) 32 | id: download-2 33 | uses: actions/download-artifact@v3 34 | continue-on-error: true 35 | with: 36 | name: ${{ inputs.name }} 37 | path: ${{ inputs.path }} 38 | if: ${{ steps.download-1.outcome == 'failure' }} 39 | 40 | - name: download artifact (try-3) 41 | id: download-3 42 | uses: actions/download-artifact@v3 43 | continue-on-error: true 44 | with: 45 | name: ${{ inputs.name }} 46 | path: ${{ inputs.path }} 47 | if: ${{ steps.download-2.outcome == 'failure' }} 48 | 49 | - name: download artifact (try-4) 50 | id: download-4 51 | uses: actions/download-artifact@v3 52 | continue-on-error: true 53 | with: 54 | name: ${{ inputs.name }} 55 | path: ${{ inputs.path }} 56 | if: ${{ steps.download-3.outcome == 'failure' }} 57 | 58 | - name: download artifact (try-5) 59 | id: download-5 60 | uses: actions/download-artifact@v3 61 | with: 62 | name: ${{ inputs.name }} 63 | path: ${{ inputs.path }} 64 | if: ${{ steps.download-4.outcome == 'failure' }} 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Download artifact retry action 2 | 3 | [![GitHub release](https://img.shields.io/github/release/cytopia/download-artifact-retry-action.svg?logo=github)](https://github.com/cytopia/download-artifact-retry-action/releases/latest) 4 | [![GitHub marketplace](https://img.shields.io/badge/marketplace-download--artifact--retry-blue?logo=github)](https://github.com/marketplace/actions/download-artifact-retry) 5 | [![](https://img.shields.io/badge/github-cytopia%2Fdownload--artifact--retry--action-red.svg?logo=github)](https://github.com/cytopia/download-artifact-retry-action "github.com/cytopia/download-artifact-retry-action") 6 | [![test](https://github.com/cytopia/download-artifact-retry-action/actions/workflows/test.yml/badge.svg)](https://github.com/cytopia/download-artifact-retry-action/actions/workflows/test.yml) 7 | 8 | This action allows you to download an artifact with retries in case the download has failed. 9 | 10 | 11 | ## :arrow_forward: Inputs 12 | 13 | The following inputs can be used to alter the Docker tag name determination: 14 | 15 | | Input | Required | Default | Description | 16 | |----------------|----------|---------|-------------------------------------------| 17 | | `name` | Yes | `` | The artifact name. | 18 | | `path` | No | `.` | The local path to download to. | 19 | 20 | 21 | ## :arrow_backward: Outputs 22 | 23 | None 24 | 25 | 26 | ## :computer: Usage 27 | 28 | ### Simple 29 | ```yaml 30 | on: [push] 31 | 32 | jobs: 33 | job1: 34 | runs-on: ubuntu-latest 35 | name: Pull docker image 36 | steps: 37 | 38 | - name: Checkout repository 39 | uses: actions/checkout@v2 40 | with: 41 | fetch-depth: 0 42 | 43 | - name: Create artifact 44 | id: file 45 | shell: bash 46 | run: | 47 | PRE_RAND="$( ${RAND} | md5sum | head -c 20; )" 48 | PRE_DATE="$( date '+%s' )" 49 | NAME="${PRE_RAND}-${PRE_DATE}.txt" 50 | echo "somedata" > "${NAME}" 51 | echo "::set-output name=path::${NAME}" 52 | 53 | - name: upload artifact 54 | uses: cytopia/upload-artifact-retry-action@v0.1.2 55 | with: 56 | name: ${{ steps.file.outputs.path }} 57 | path: ${{ steps.file.outputs.path }} 58 | 59 | - name: download artifact 60 | uses: cytopia/download-artifact-retry-action@v0.1.0 61 | with: 62 | name: ${{ steps.file.outputs.path }} 63 | ``` 64 | 65 | 66 | ## :exclamation: Keep up-to-date with GitHub Dependabot 67 | 68 | Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot) has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem), to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file: 69 | 70 | ```yml 71 | version: 2 72 | updates: 73 | # Maintain dependencies for GitHub Actions 74 | - package-ecosystem: "github-actions" 75 | directory: "/" 76 | schedule: 77 | interval: "daily" 78 | ``` 79 | 80 | 81 | ## :octocat: [cytopia](https://github.com/cytopia) GitHub Actions 82 | 83 | | Name | Description | 84 | |----------------------------------|-------------| 85 | | [docker-tag-action] | Determines Docker tags based on git branch, commit or git tag | 86 | | [git-ref-matrix-action] | Create stringified JSON list of git refs to be used as a build matrix | 87 | | [shell-command-retry-action] | Retries shell commands to avoid failing pipelines due to network issues | 88 | | [upload-artifact-verify-action] | Upload artifact and verifies it by downloading it again | 89 | | [upload-artifact-retry-action] | Retries `upload-artifact-verify-action` | 90 | | [download-artifact-retry-action] | Download artifact with retry functionality | 91 | 92 | [docker-tag-action]: https://github.com/cytopia/docker-tag-action 93 | [git-ref-matrix-action]: https://github.com/cytopia/git-ref-matrix-action 94 | [shell-command-retry-action]: https://github.com/cytopia/shell-command-retry-action 95 | [upload-artifact-verify-action]: https://github.com/cytopia/upload-artifact-verify-action 96 | [upload-artifact-retry-action]: https://github.com/cytopia/upload-artifact-retry-action 97 | [download-artifact-retry-action]: https://github.com/cytopia/download-artifact-retry-action 98 | 99 | 100 | ## :page_facing_up: License 101 | 102 | **[MIT License](LICENSE)** 103 | 104 | Copyright (c) 2022 [cytopia](https://github.com/cytopia) 105 | --------------------------------------------------------------------------------