mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-22 08:06:10 -07:00
Fixed deleting files from $CLONE_DIR (keep $CLONE_DIR/.git and deletes files like $CLONE_DIR/.gitattributes)
Thanks @ruuk for the report
This commit is contained in:
parent
e7bc77c21d
commit
ec672cbc0a
|
@ -27,13 +27,20 @@ git clone --single-branch --branch "$TARGET_BRANCH" "https://$API_TOKEN_GITHUB@g
|
||||||
ls -la "$CLONE_DIR"
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
echo "Cleaning destination repository of old files"
|
echo "Cleaning destination repository of old files"
|
||||||
# Copy files into the git and deletes all git
|
# Deletes the conents of $CLONE_DIR with three exceptions (! -path "..."):
|
||||||
find "$CLONE_DIR" | grep -v "^$CLONE_DIR/\.git$" | grep -v "^$CLONE_DIR$" | xargs rm -vrf # delete all files (to handle deletions)
|
# -Skips the $CLONE_DIR/ directory itself
|
||||||
|
# -Skips the contents of $CLONE_DIR/.git/*
|
||||||
|
# -Skips the $CLONE_DIR/.git
|
||||||
|
find "$CLONE_DIR/" ! -path "$CLONE_DIR/" ! -path "$CLONE_DIR/.git/*" ! -path "$CLONE_DIR/.git" -exec rm -rf {} \;
|
||||||
|
|
||||||
|
echo "Contents of $CLONE_DIR after deleting everything but .git"
|
||||||
ls -la "$CLONE_DIR"
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
echo "Copying contents to git repo"
|
echo "Copying contents to git repo"
|
||||||
cp -r "$SOURCE_DIRECTORY"/* "$CLONE_DIR"
|
cp -r "$SOURCE_DIRECTORY"/* "$CLONE_DIR"
|
||||||
cd "$CLONE_DIR"
|
cd "$CLONE_DIR"
|
||||||
|
|
||||||
|
echo "Files that will be pushed"
|
||||||
ls -la
|
ls -la
|
||||||
|
|
||||||
echo "Adding git commit"
|
echo "Adding git commit"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user