-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,10 @@ UPSTREAM_URL=$1 | |
UPSTREAM_BRANCH=$2 | ||
REBASE_BRANCH=$3 | ||
|
||
git config pull.rebase true | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
# Add and update upstream remote. | ||
if ! git remote | grep upstream; then | ||
git remote add upstream $UPSTREAM_URL | ||
|
@@ -15,15 +19,14 @@ git fetch --all --prune | |
|
||
# Checkout or create $REBASE_BRANCH. | ||
if git show-ref --verify --quiet refs/remotes/origin/$REBASE_BRANCH; then | ||
echo "Resetting $REBASE_BRANCH branch to origin/$REBASE_BRANCH branch." | ||
git switch $REBASE_BRANCH | ||
git pull origin $REBASE_BRANCH | ||
git reset --hard origin/$REBASE_BRANCH | ||
else | ||
echo "Creating $REBASE_BRANCH branch from $UPSTREAM_BRANCH branch." | ||
git switch -c $REBASE_BRANCH | ||
fi | ||
|
||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
# Create upstream branch from upstream/$UPSTREAM_BRANCH. | ||
git branch upstream upstream/$UPSTREAM_BRANCH | ||
git push --set-upstream origin upstream | ||
|