Skip to content

Commit 4f46721

Browse files
committed
Make source optional
We want to make source optional to make the action for example only run createrepo without actually uploading any files. This is needed in cases where concurrent uploads can happen, but only a single createrepo needs to be executed (as createrepo fails when already running). Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
1 parent 2911310 commit 4f46721

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ inputs:
1717
default: "22"
1818
source:
1919
description: 'Files to upload. This parameter allows globbing.'
20-
required: true
20+
required: false
2121
target:
2222
description: 'Target directory on resources.ovirt.org.'
2323
required: false
@@ -84,7 +84,7 @@ runs:
8484
exit 128
8585
fi
8686
echo -e "\e[32mValidating source...\e[0m"
87-
if [ -z "$(ls ${SOURCE})" ]; then
87+
if [ -n "${SOURCE}" -a -z "$(ls ${SOURCE})" ]; then
8888
echo -e "\e[31mThe source you provided matches no files.\e[0m" >&2
8989
exit 128
9090
fi
@@ -159,7 +159,7 @@ runs:
159159
DELETE_BEFORE_UPLOAD: ${{ inputs.delete_before_upload }}
160160
PORT: ${{ inputs.port }}
161161
KNOWN_HOSTS: ${{ inputs.known_hosts }}
162-
if: inputs.delete_before_upload == 'yes'
162+
if: inputs.delete_before_upload == 'yes' && inputs.source != ''
163163
shell: bash
164164
run: |
165165
set -e
@@ -179,6 +179,7 @@ runs:
179179
SOURCE: ${{ inputs.source }}
180180
TARGET: ${{ inputs.target }}
181181
PORT: ${{ inputs.port }}
182+
if: inputs.source != ''
182183
shell: bash
183184
run: |
184185
set -e

0 commit comments

Comments
 (0)