Skip to content

Commit 38b1efb

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

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Rebase release-dev/* onto main
2+
3+
on:
4+
schedule:
5+
- cron: "0 20 * * *" # 8pm UTC daily, 1pm EST daily
6+
workflow_dispatch: # Allow manual trigger
7+
8+
jobs:
9+
rebase-release-dev:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Setup Git
19+
run: |
20+
git config user.name "GitHub Actions"
21+
git config user.email "[email protected]"
22+
23+
- name: Fetch all branches
24+
run: git fetch origin "+refs/heads/*:refs/remotes/origin/*"
25+
26+
- name: Rebase each release-dev/* branch onto main
27+
run: |
28+
for branch in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin/release-dev/*); do
29+
echo "Processing $branch"
30+
bname=$(basename $branch)
31+
git checkout -B $bname $branch
32+
git rebase origin/main || {
33+
echo "Rebase failed for $bname. Skipping push."
34+
continue
35+
}
36+
git push origin $bname
37+
done
38+

0 commit comments

Comments
 (0)