mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-22 08:06:10 -07:00
Does better job with the directory creation, naming, etc.
This commit is contained in:
parent
0f0c204dae
commit
30ad5ed618
|
@ -6,18 +6,23 @@ GITHUB_USERNAME="$2"
|
||||||
GITHUB_REPO="$3"
|
GITHUB_REPO="$3"
|
||||||
GIT_USER_EMAIL="$4"
|
GIT_USER_EMAIL="$4"
|
||||||
|
|
||||||
CLONE_DIR="clone_repo"
|
CLONE_DIR=$(mktemp)
|
||||||
|
|
||||||
# Setup git
|
# Setup git
|
||||||
git config --global user.email "$GIT_USER_EMAIL"
|
git config --global user.email "$GIT_USER_EMAIL"
|
||||||
git config --global user.name "$GITHUB_USERNAME"
|
git config --global user.name "$GITHUB_USERNAME"
|
||||||
git clone "https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
git clone "https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
||||||
|
|
||||||
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
# Copy files into the git and deletes all git
|
# Copy files into the git and deletes all git
|
||||||
|
find "$CLONE_DIR" | grep -v "^$CLONE_DIR/\.git" | xargs rm -rf # delete all files (to handle deletions)
|
||||||
|
|
||||||
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
|
cp -r "$FOLDER"/* "$CLONE_DIR"
|
||||||
|
|
||||||
cd "$CLONE_DIR"
|
cd "$CLONE_DIR"
|
||||||
# find needs to be in the git repository directory
|
|
||||||
find . | grep -v ".git" | grep -v "^\.*$" | xargs rm -rf # delete all files (to handle deletions)
|
|
||||||
cp -r "../$FOLDER"/* .
|
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
git commit --message "Update from $GITHUB_REPOSITORY"
|
git commit --message "Update from $GITHUB_REPOSITORY"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user