Skip to content

Commit

Permalink
Merge pull request #1 from jbh/master
Browse files Browse the repository at this point in the history
Only create directories/files if they don't exist
  • Loading branch information
fifsky authored Sep 24, 2019
2 parents 916caf5 + 0c31898 commit f991cba
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
sh -c "ssh -i $SSHPATH/deploy_key -o StrictHostKeyChecking=no -p $INPUT_PORT ${INPUT_USER}@${INPUT_HOST} < $HOME/shell.sh"

0 comments on commit f991cba

Please sign in to comment.