mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-05 08:05:47 -06:00
Improve conditional logic for directory and file transfer handling
This commit is contained in:
parent
7a84e4fb52
commit
86e4dfff89
@ -102,7 +102,7 @@ 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"
|
||||||
|
|
||||||
# check if sourcefile and target file is not set
|
# Do this if sourcefile and target file is not set, means we are doing a directory transfer
|
||||||
if [ -z "$SOURCE_FILE" ] && [ -z "$TARGET_FILE" ]
|
if [ -z "$SOURCE_FILE" ] && [ -z "$TARGET_FILE" ]
|
||||||
then
|
then
|
||||||
# $TARGET_DIRECTORY is '' by default
|
# $TARGET_DIRECTORY is '' by default
|
||||||
@ -123,8 +123,8 @@ ls -al /
|
|||||||
|
|
||||||
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
||||||
|
|
||||||
# if source directory is set
|
# If sourcefile and target file is not set, means we are doing a directory transfer
|
||||||
if [ -n "$SOURCE_DIRECTORY" ]
|
if [ -z "$SOURCE_FILE" ] && [ -z "$TARGET_FILE" ]
|
||||||
then
|
then
|
||||||
echo "[+] List contents of $SOURCE_DIRECTORY"
|
echo "[+] List contents of $SOURCE_DIRECTORY"
|
||||||
ls "$SOURCE_DIRECTORY"
|
ls "$SOURCE_DIRECTORY"
|
||||||
@ -144,10 +144,11 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[+] Copying contents of source repository folder $SOURCE_DIRECTORY to folder $TARGET_DIRECTORY in git repo $DESTINATION_REPOSITORY_NAME"
|
echo "[+] Copying contents of source repository folder $SOURCE_DIRECTORY to folder $TARGET_DIRECTORY in git repo $DESTINATION_REPOSITORY_NAME"
|
||||||
cp -ra "$SOURCE_DIRECTORY"/. "$CLONE_DIR/$TARGET_DIRECTORY"
|
cp -ra "$SOURCE_DIRECTORY"/. "$CLONE_DIR/$TARGET_DIRECTORY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If sourcefile and target file is set, means we are doing a file transfer
|
||||||
if [ -n "$SOURCE_FILE" ] && [ -n "$TARGET_FILE" ]
|
if [ -n "$SOURCE_FILE" ] && [ -n "$TARGET_FILE" ]
|
||||||
then
|
then
|
||||||
echo "[+] SOURCE_FILE: $SOURCE_FILE"
|
echo "[+] SOURCE_FILE: $SOURCE_FILE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user