If no directory to be deleted avoids... deleting the directory

This commit is contained in:
Carles Pina i Estany 2021-10-25 23:55:36 +01:00
parent 371fdd6652
commit 5ca36a784d
2 changed files with 23 additions and 24 deletions

View File

@ -46,7 +46,7 @@ inputs:
required: false required: false
target-directory: target-directory:
description: '[Optional] The directory to wipe and replace in the target repository' description: '[Optional] The directory to wipe and replace in the target repository'
default: . default: ''
required: false required: false
runs: runs:

View File

@ -41,6 +41,8 @@ TEMP_DIR=$(mktemp -d)
# including "." and with the exception of ".git/" # including "." and with the exception of ".git/"
mv "$CLONE_DIR/.git" "$TEMP_DIR/.git" mv "$CLONE_DIR/.git" "$TEMP_DIR/.git"
if [ -n "$TARGET_DIRECTORY" ]
then
echo "[+] Checking if $TARGET_DIRECTORY exist in git repo $DESTINATION_REPOSITORY_NAME" echo "[+] Checking if $TARGET_DIRECTORY exist in git repo $DESTINATION_REPOSITORY_NAME"
# Remove contents of target directory and create a new empty one # Remove contents of target directory and create a new empty one
@ -56,16 +58,13 @@ mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
echo "[+] Listing Current Directory Location" echo "[+] Listing Current Directory Location"
ls -al ls -al
#echo "[+] Listing home+ Directory Location"
#ls -al /home/runner/work/Action_OpenWRT_AutoBuild_Linksys_Devices/Action_OpenWRT_AutoBuild_Linksys_Devices/openwrt
echo "[+] Listing root Location" echo "[+] Listing root Location"
ls -al / ls -al /
echo "[+] Listing /home Location" echo "[+] Listing /home Location"
ls -al /home ls -al /home
fi
# echo "[+] Changing to $SOURCE_BEFORE_DIRECTORY"
# cd "$SOURCE_BEFORE_DIRECTORY"
echo "[+] List contents of $SOURCE_DIRECTORY" echo "[+] List contents of $SOURCE_DIRECTORY"
ls "$SOURCE_DIRECTORY" ls "$SOURCE_DIRECTORY"