diff --git a/entrypoint.sh b/entrypoint.sh index 9df1b03..227bcb2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,8 +5,16 @@ set -eu printf '\033[33m Warning: This action does not currently support host verification; verification is disabled. \n \033[0m\n' SSHPATH="$HOME/.ssh" -mkdir "$SSHPATH" -touch "$SSHPATH/known_hosts" + +if [ ! -d "$SSHPATH" ] +then + mkdir "$SSHPATH" +fi + +if [ ! -f "$SSHPATH/known_hosts" ] +then + touch "$SSHPATH/known_hosts" +fi echo "$INPUT_KEY" > "$SSHPATH/deploy_key" chmod 700 "$SSHPATH" @@ -17,4 +25,4 @@ echo "$INPUT_COMMAND" > $HOME/shell.sh cat $HOME/shell.sh echo Start Run Command -sh -c "ssh -i $SSHPATH/deploy_key -o StrictHostKeyChecking=no -p $INPUT_PORT ${INPUT_USER}@${INPUT_HOST} < $HOME/shell.sh" \ No newline at end of file +sh -c "ssh -i $SSHPATH/deploy_key -o StrictHostKeyChecking=no -p $INPUT_PORT ${INPUT_USER}@${INPUT_HOST} < $HOME/shell.sh"