-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rebase org- branches on trunk (#6456)
- Adding github actions to automatically rebase org- branches on trunk when master get's a merge
- Loading branch information
1 parent
30e47f3
commit b426483
Showing
2 changed files
with
47 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Rebase Organization Branches | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Rebase Organization Branches | ||
run: | | ||
chmod +x rebase_organization_branches.sh | ||
./rebase_organization_branches.sh | ||
env: | ||
QC_GIT_TOKEN: ${{ secrets.QC_GIT_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
echo "Start Rebasing Organization Branches" | ||
git config user.name "$(git log -n 1 --pretty=format:%an)" | ||
git config user.email "$(git log -n 1 --pretty=format:%ae)" | ||
|
||
git remote set-branches origin '*' | ||
git checkout -- . | ||
git clean -xqdf | ||
|
||
for branch in $(git for-each-ref refs/remotes/origin/* | cut -d"$(printf '\t')" -f2 | cut -b21- | grep ^org-) | ||
do | ||
echo "Rebasing branch $branch" | ||
git checkout $branch | ||
git rebase master | ||
retVal=$? | ||
if [ $retVal -eq 0 ]; then | ||
echo "Pushing branch $branch" | ||
git push --force-with-lease --set-upstream origin $branch | ||
else | ||
echo "Rebase failed branch $branch" | ||
git rebase --abort | ||
fi | ||
git checkout master | ||
git clean -xqdf | ||
done |