mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-05 00:05:45 -06:00
Add conditional directory/file handling for source and target
This commit is contained in:
parent
6c4b6891cf
commit
fa622ad30b
@ -102,22 +102,26 @@ 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"
|
||||||
|
|
||||||
# $TARGET_DIRECTORY is '' by default
|
# check if sourcefile and target file is not set
|
||||||
ABSOLUTE_TARGET_DIRECTORY="$CLONE_DIR/$TARGET_DIRECTORY/"
|
if [ -z "$SOURCE_FILE" ] && [ -z "$TARGET_FILE" ]
|
||||||
|
then
|
||||||
|
# $TARGET_DIRECTORY is '' by default
|
||||||
|
ABSOLUTE_TARGET_DIRECTORY="$CLONE_DIR/$TARGET_DIRECTORY/"
|
||||||
|
|
||||||
echo "[+] Deleting $ABSOLUTE_TARGET_DIRECTORY"
|
echo "[+] Deleting $ABSOLUTE_TARGET_DIRECTORY"
|
||||||
rm -rf "$ABSOLUTE_TARGET_DIRECTORY"
|
rm -rf "$ABSOLUTE_TARGET_DIRECTORY"
|
||||||
|
|
||||||
echo "[+] Creating (now empty) $ABSOLUTE_TARGET_DIRECTORY"
|
echo "[+] Creating (now empty) $ABSOLUTE_TARGET_DIRECTORY"
|
||||||
mkdir -p "$ABSOLUTE_TARGET_DIRECTORY"
|
mkdir -p "$ABSOLUTE_TARGET_DIRECTORY"
|
||||||
|
|
||||||
echo "[+] Listing Current Directory Location"
|
echo "[+] Listing Current Directory Location"
|
||||||
ls -al
|
ls -al
|
||||||
|
|
||||||
echo "[+] Listing root Location"
|
echo "[+] Listing root Location"
|
||||||
ls -al /
|
ls -al /
|
||||||
|
|
||||||
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
||||||
|
fi
|
||||||
|
|
||||||
# if source directory is set
|
# if source directory is set
|
||||||
if [ -n "$SOURCE_DIRECTORY" ]
|
if [ -n "$SOURCE_DIRECTORY" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user