Skip to content

Commit b6b9c4c

Browse files
committed
ci: add github action to auto rebase release-dev/* onto main
1 parent 5ffb1b8 commit b6b9c4c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Rebase release-dev/* onto main
2+
3+
on:
4+
schedule:
5+
- cron: "0 20 * * *" # Runs at 8pm UTC daily
6+
workflow_dispatch:
7+
8+
jobs:
9+
rebase-release-dev:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Setup Git
20+
run: |
21+
git config user.name "GitHub Actions"
22+
git config user.email "[email protected]"
23+
24+
- name: Fetch all remote branches
25+
run: |
26+
git fetch origin "+refs/heads/*:refs/remotes/origin/*"
27+
28+
- name: Rebase each release-dev/* branch onto main
29+
run: |
30+
MAIN_BRANCH=main
31+
for BRANCH in $(git branch -r | grep 'origin/release-dev/' | sed 's|origin/||'); do
32+
echo "Rebasing $BRANCH onto $MAIN_BRANCH"
33+
git checkout $BRANCH
34+
git rebase origin/$MAIN_BRANCH || {
35+
echo "Rebase failed for $BRANCH, skipping push"
36+
git rebase --abort
37+
continue
38+
}
39+
git push origin $BRANCH --force-with-lease
40+
done

0 commit comments

Comments
 (0)