|
| 1 | +name: "Upload artifact (with retry)" |
| 2 | +description: "Upload artifact with automatic retry on failure" |
| 3 | +inputs: |
| 4 | + name: |
| 5 | + description: "Artifact name" |
| 6 | + required: true |
| 7 | + path: |
| 8 | + description: "Path(s) to upload" |
| 9 | + required: true |
| 10 | + retention-days: |
| 11 | + description: "Number of days to retain the artifact (empty = repo default)" |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + if-no-files-found: |
| 15 | + description: "Behavior when no files are found: warn, error, or ignore" |
| 16 | + required: false |
| 17 | + default: 'warn' |
| 18 | + include-hidden-files: |
| 19 | + description: "Whether to include hidden files in the artifact" |
| 20 | + required: false |
| 21 | + default: 'false' |
| 22 | + |
| 23 | +runs: |
| 24 | + using: composite |
| 25 | + steps: |
| 26 | + - name: Upload artifact (attempt 1) |
| 27 | + id: upload1 |
| 28 | + continue-on-error: true |
| 29 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 30 | + with: |
| 31 | + name: ${{ inputs.name }} |
| 32 | + path: ${{ inputs.path }} |
| 33 | + retention-days: ${{ inputs.retention-days }} |
| 34 | + if-no-files-found: ${{ inputs.if-no-files-found }} |
| 35 | + include-hidden-files: ${{ inputs.include-hidden-files }} |
| 36 | + - name: Wait before retry (attempt 2) |
| 37 | + if: steps.upload1.outcome == 'failure' |
| 38 | + shell: bash |
| 39 | + run: sleep 5 |
| 40 | + - name: Upload artifact (attempt 2) |
| 41 | + id: upload2 |
| 42 | + if: steps.upload1.outcome == 'failure' |
| 43 | + continue-on-error: true |
| 44 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 45 | + with: |
| 46 | + name: ${{ inputs.name }} |
| 47 | + path: ${{ inputs.path }} |
| 48 | + retention-days: ${{ inputs.retention-days }} |
| 49 | + if-no-files-found: ${{ inputs.if-no-files-found }} |
| 50 | + include-hidden-files: ${{ inputs.include-hidden-files }} |
| 51 | + - name: Wait before retry (attempt 3) |
| 52 | + if: steps.upload2.outcome == 'failure' |
| 53 | + shell: bash |
| 54 | + run: sleep 10 |
| 55 | + - name: Upload artifact (attempt 3) |
| 56 | + if: steps.upload2.outcome == 'failure' |
| 57 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 58 | + with: |
| 59 | + name: ${{ inputs.name }} |
| 60 | + path: ${{ inputs.path }} |
| 61 | + retention-days: ${{ inputs.retention-days }} |
| 62 | + if-no-files-found: ${{ inputs.if-no-files-found }} |
| 63 | + include-hidden-files: ${{ inputs.include-hidden-files }} |
0 commit comments