More shells cript fixes

This commit is contained in:
shockrah 2024-09-28 14:46:41 -07:00
parent fd7c104073
commit 6333f32c32
2 changed files with 7 additions and 5 deletions

View File

@ -30,7 +30,7 @@ It is recommended to pass all sensitive values through `secrets`
```yaml ```yaml
name: Copy single file name: Copy single file
uses: tempersama/rsync-action@2.2 uses: tempersama/rsync-action@2.3
with: with:
host: ${{ secrets.host }} host: ${{ secrets.host }}
source: html/ source: html/

View File

@ -3,13 +3,14 @@
set -e set -e
# Quick checks for missing parameters # Quick checks for missing parameters
rc=0 empty() {
empty() { echo ERROR: $1 is empty } echo "ERROR: $1 is empty"
}
[[ "$INPUT_HOST" ]] && empty host [[ "$INPUT_HOST" ]] && empty host
[[ "$INPUT_SOURCE" ]] && empty source [[ "$INPUT_SOURCE" ]] && empty source
[[ "$INPUT_DESTINATION" ]] && empty destination [[ "$INPUT_DESTINATION" ]] && empty destination
[[ "$INPUT_USERNME" ]] && empty username [[ "$INPUT_USERNAME" ]] && empty username
[[ "$INPUT_KEY" ]] && empty key [[ "$INPUT_KEY" ]] && empty key
@ -21,6 +22,7 @@ chmod 400 key
rsync \ rsync \
-a -v \ --stats \ -a -v \ --stats \
-e "ssh -o StrictHostKeyChecking=no -i key" \ -e "ssh -o StrictHostKeyChecking=no -i key" \
--port $INPUT_PORT \ --port "$INPUT_PORT" \
"$INPUT_SOURCE" \ "$INPUT_SOURCE" \
"$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION" "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"