From 37da2de5a1e8d3b130316868cdcfd313539a94d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 17 Oct 2023 16:04:55 +0200 Subject: [PATCH] check for ssh key --- action.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 384dd62..01abc17 100755 --- a/action.sh +++ b/action.sh @@ -6,7 +6,10 @@ SSH_KEY_FILE=/tmp/gitea-pages-ssh-key-$(date +%s) echo "${INPUT_SSH_KEY}" >> "${SSH_KEY_FILE}" chmod 600 "${SSH_KEY_FILE}" -cat "${SSH_KEY_FILE}" +if [ ! -s "${SSH_KEY_FILE}" ]; then + echo "Missing ssh key, aborting deploy." + exit 1 +fi # set up ssh remote key echo "${INPUT_HOST} ${INPUT_HOST_KEY}" >> ~/.ssh/known_hosts @@ -14,6 +17,7 @@ echo "${INPUT_HOST} ${INPUT_HOST_KEY}" >> ~/.ssh/known_hosts # check if directory present if [ ! -d "${INPUT_DIRECTORY}" ]; then echo "Directory ${INPUT_DIRECTORY} does not exist, aborting deploy." + exit 1 fi # optionally: create index