-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
70 lines (63 loc) · 2.08 KB
/
action.yaml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: 'setup-workspace'
description: 'Setup job workspace'
inputs:
artifact_name_override:
description: Override name of artifact to use
required: false
checkout_fetch_depth:
description: Depth to fetch repository
required: false
default: '1'
checkout_artifact:
description: Whether to checkout artifact instead of source
required: false
default: 'false'
runs:
using: composite
steps:
- name: Set extra GitHub environment variables
id: github-env-vars
uses: rlespinasse/github-slug-action@v4
- name: Check checkout type
id: checkout-type
shell: bash
env:
CHECKOUT_ARTIFACT: ${{ inputs.checkout_artifact }}
run: |
if [ "$CHECKOUT_ARTIFACT" = "true" ] ; then
echo "is-artifact=true" >> $GITHUB_OUTPUT
echo "is-source=false" >> $GITHUB_OUTPUT
elif [ "$CHECKOUT_ARTIFACT" = "false" ] ; then
echo "is-artifact=false" >> $GITHUB_OUTPUT
echo "is-source=true" >> $GITHUB_OUTPUT
else
echo "checkout_artifact must be `true` or `false`"
exit 1
fi
- name: Checkout source
id: checkout-source
if: inputs.checkout_artifact == 'false'
uses: actions/checkout@v4
with:
fetch-depth: ${{ inputs.checkout_fetch_depth }}
- name: Set artifact name
id: set-artifact-name
uses: ServerlessOpsIO/gha-artifact-name@v1
with:
artifact_name_override: ${{ inputs.artifact_name_override }}
- name: Download artifact
id: download-artifact
if: inputs.checkout_artifact == 'true'
uses: actions/download-artifact@v4
with:
name: ${{ steps.set-artifact-name.outputs.artifact-name }}
outputs:
artifact-name:
description: Name of artifact downloaded
value: ${{ steps.set-artifact-name.outputs.artifact-name }}
is-artifact:
description: Checkout type is artifact
value: ${{ steps.checkout-type.outputs.is-artifact }}
is-source:
description: Checkout type is source
value: ${{ steps.checkout-type.outputs.is-source }}