-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
40 lines (39 loc) · 1.7 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# LICENSE: LGPL-3.0-or-later
name: Check Artifact v4 Existence
description: Checks if an artifact with a given name, uploaded with actions/upload-artifact@v4, exists. If it does, the `exists`
property is set on the `outputs` context.
`exists` will be set to `true` if it the artifact was downloaded, `false` it couldn't be downloaded. It could also be `null`
if something in the composite workflow failed and it never couldn't got to the end, if the `download-artifact` call was skipped
or something else strange happened.
inputs:
name:
description: 'Name of the artifact to check'
required: true
outputs:
exists:
description: Determines if the artifact with the provided name is present and can be downloaded.
value: ${{ steps.result.outputs.exists }}
runs:
using: "composite"
steps:
- name: Generate random directory to download artifact into
shell: bash
run: echo "random_directory=d$(($RANDOM))" >> $GITHUB_OUTPUT
id: gen-random
- name: Attempt to download the artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.name }}
path: "${{ steps.gen-random.outputs.random_directory }}/"
continue-on-error: true
id: artifact-download
- name: Delete the artifact download directory if it was used
run: |
rm -rf ${{ steps.gen-random.outputs.random_directory }}/
shell: bash
- name: Set exists to true if artifact exists, if it couldn't be downloaded.
run: |
echo "exists=${{ steps.artifact-download.outcome == 'success' }}" >> $GITHUB_OUTPUT
shell: bash
if: ${{ steps.artifact-download.outcome == 'success' || steps.artifact-download.outcome == 'failure'}}
id: result