Skip to content

Commit

Permalink
Add support for copying source directories recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
betanzos committed Dec 4, 2021
1 parent 4afbc82 commit 6681a6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
description: 'Remote directory to copy the file'
required: false
default: '~'
recursive:
description: 'Recursively copy entire source directories. Valid values: true and false (specified as strings)'
required: false
default: 'false'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ else
ssh -i key -o "StrictHostKeyChecking no" -p $INPUT_PORT "$INPUT_USERNAME"@"$INPUT_HOST" "mkdir -p ${remote_dir}/"
fi

recursive=""
if [ "$INPUT_RECURSIVE" = "true" ]; then
recursive="-r"
fi

# Copy the file
scp -i key -o "StrictHostKeyChecking no" -P $INPUT_PORT "$INPUT_SOURCE" "$INPUT_USERNAME"@"$INPUT_HOST":$remote_dir
scp $recursive -i key -o "StrictHostKeyChecking no" -P $INPUT_PORT "$INPUT_SOURCE" "$INPUT_USERNAME"@"$INPUT_HOST":$remote_dir

# Clean
cat /dev/null > ~/.bash_history
Expand Down

0 comments on commit 6681a6d

Please sign in to comment.