mirror of
https://github.com/wlixcc/SFTP-Deploy-Action.git
synced 2026-09-23 13:18:32 +00:00
fix: use default value for unset passphrase parameter to prevent error
Update the script to reference the 12th parameter as ${12:-} instead of ${12} when checking for a passphrase. This change prevents the script from failing with a "parameter not set" error under set -u if the passphrase is not provided.
This commit is contained in:
+2
-2
@@ -84,7 +84,7 @@ else
|
||||
fi
|
||||
|
||||
# check if passphrase is set, if yes decrypt the private key
|
||||
if [ -n "${12}" ]; then
|
||||
if [ -n "${12:-}" ]; then
|
||||
echo 'Use ssh-agent to decrypt private key with passphrase'
|
||||
# start ssh agent
|
||||
eval $(ssh-agent -s)
|
||||
@@ -105,7 +105,7 @@ sftp -b $TEMP_SFTP_FILE -P $3 $8 -o StrictHostKeyChecking=no -i $TEMP_SSH_PRIVAT
|
||||
|
||||
echo 'Deploy Success'
|
||||
# if passphrase is set stop ssh-agent after sftp connection
|
||||
if [ -n "${12}" ]; then
|
||||
if [ -n "${12:-}" ]; then
|
||||
echo 'Clear keys from ssh-agent'
|
||||
# delete all keys from RAM
|
||||
ssh-add -D
|
||||
|
||||
Reference in New Issue
Block a user