mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-22 08:06:10 -07:00
Fix deleting of files when TARGET_DIRECTORY is not specified
This commit is contained in:
parent
24c550e8a7
commit
e7314057a0
|
@ -41,25 +41,20 @@ 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" ]
|
# $TARGET_DIRECTORY is '' by default
|
||||||
then
|
ABSOLUTE_TARGET_DIRECTORY="$CLONE_DIR/$TARGET_DIRECTORY/"
|
||||||
echo "[+] Checking if $TARGET_DIRECTORY exist in git repo $DESTINATION_REPOSITORY_NAME"
|
|
||||||
|
|
||||||
# Remove contents of target directory and create a new empty one
|
echo "[+] Deleting $ABSOLUTE_TARGET_DIRECTORY"
|
||||||
if [ -d "$CLONE_DIR/$TARGET_DIRECTORY/" ]
|
rm -rf "$ABSOLUTE_TARGET_DIRECTORY"
|
||||||
then
|
|
||||||
echo "[+] Deleting files from $TARGET_DIRECTORY in git repo $DESTINATION_REPOSITORY_NAME"
|
|
||||||
rm -R "$CLONE_DIR/$TARGET_DIRECTORY/"
|
|
||||||
fi
|
|
||||||
echo "[+] Creating $TARGET_DIRECTORY if it does not already exist"
|
|
||||||
mkdir -p "$CLONE_DIR/$TARGET_DIRECTORY"
|
|
||||||
|
|
||||||
echo "[+] Listing Current Directory Location"
|
echo "[+] Creating (now empty) $ABSOLUTE_TARGET_DIRECTORY"
|
||||||
ls -al
|
mkdir -p "$ABSOLUTE_TARGET_DIRECTORY"
|
||||||
|
|
||||||
echo "[+] Listing root Location"
|
echo "[+] Listing Current Directory Location"
|
||||||
ls -al /
|
ls -al
|
||||||
fi
|
|
||||||
|
echo "[+] Listing root Location"
|
||||||
|
ls -al /
|
||||||
|
|
||||||
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user