From 0370813668327ada375fb05b879ac6a77efe3d16 Mon Sep 17 00:00:00 2001 From: Steven Agyekum Date: Tue, 12 Nov 2019 22:49:15 +0100 Subject: [PATCH] fix 'mkdir: cannot create directory' error Fix ``mkdir: cannot create directory '/github/home/.ssh': File exists`` error --- entrypoint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index da9aea6..2c1ef34 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,10 +4,12 @@ set -eu # Set deploy key SSH_PATH="$HOME/.ssh" -mkdir "$SSH_PATH" +# Create .ssh dir if it doesn't exist +[[ -d "$SSH_PATH" ]] || mkdir "$SSH_PATH" +# Place deploy_key into .ssh dir echo "$DEPLOY_KEY" > "$SSH_PATH/deploy_key" +# Set r+w to user only chmod 600 "$SSH_PATH/deploy_key" - # Do deployment sh -c "rsync $INPUT_SWITCHES -e 'ssh -i $SSH_PATH/deploy_key -o StrictHostKeyChecking=no' $INPUT_EXCLUDES $GITHUB_WORKSPACE/$INPUT_PATH $INPUT_UPLOAD_PATH"