mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-22 08:06:10 -07:00
adding context and setting upstream
This commit is contained in:
parent
b174d4c1a3
commit
b511d6418a
|
@ -14,22 +14,27 @@ fi
|
||||||
|
|
||||||
CLONE_DIR=$(mktemp -d)
|
CLONE_DIR=$(mktemp -d)
|
||||||
|
|
||||||
|
echo "Cloning destination git repository"
|
||||||
# Setup git
|
# Setup git
|
||||||
git config --global user.email "$USER_EMAIL"
|
git config --global user.email "$USER_EMAIL"
|
||||||
git config --global user.name "$GITHUB_USERNAME"
|
git config --global user.name "$GITHUB_USERNAME"
|
||||||
git clone "https://$API_TOKEN_GITHUB@github.com/$REPO_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
git clone "https://$API_TOKEN_GITHUB@github.com/$REPO_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
||||||
|
|
||||||
ls -la "$CLONE_DIR"
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
|
echo "Cleaning destination repository of old files"
|
||||||
# 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" | grep -v "^$CLONE_DIR$" | xargs rm -rf # delete all files (to handle deletions)
|
find "$CLONE_DIR" | grep -v "^$CLONE_DIR/\.git" | grep -v "^$CLONE_DIR$" | xargs rm -rf # delete all files (to handle deletions)
|
||||||
|
|
||||||
ls -la "$CLONE_DIR"
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
|
echo "Copying contents to to git repo"
|
||||||
cp -r "$FOLDER"/* "$CLONE_DIR"
|
cp -r "$FOLDER"/* "$CLONE_DIR"
|
||||||
|
|
||||||
cd "$CLONE_DIR"
|
cd "$CLONE_DIR"
|
||||||
|
ls -la
|
||||||
|
|
||||||
|
echo "Adding git commit"
|
||||||
git add .
|
git add .
|
||||||
|
git status
|
||||||
git commit --message "Update from https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
git commit --message "Update from https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
||||||
git push origin master
|
|
||||||
|
echo "Pushing git commit"
|
||||||
|
git push -u rigin master
|
||||||
|
|
Loading…
Reference in New Issue
Block a user