generated from 3Kmfi6HP/EDtunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1.2 KB
/
sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: "🔄 Sync all branches with main"
on:
workflow_dispatch:
jobs:
sync_branches:
runs-on: ubuntu-latest
name: "🔄 Sync branches with main"
env:
EMAIL: ${{ secrets.GH_EMAIL }}
NAME: ${{ secrets.GH_USERNAME }}
TOKEN: ${{ secrets.TOKEN }}
REMOTE_NAME: origin
BRANCH_BASE_NAME: proxyip
BRANCH_COUNT: 200
steps:
- name: 🛠 Set up Git config
run: |
git config --global user.email "${{ env.EMAIL }}"
git config --global user.name "${{ env.NAME }}"
- name: 📥 Clone repository
run: |
git clone https:///${{ env.TOKEN }}@github.com/${{github.repository}}.git
cd $(echo ${{github.repository}} | awk -F'/' '{print $2}')
- name: 🔄 Sync and push branches
run: |
cd $(echo ${{github.repository}} | awk -F'/' '{print $2}')
git checkout main
git pull ${REMOTE_NAME} main
for ((i=1; i<=${{ env.BRANCH_COUNT }}; i++)); do
branch_name="${{ env.BRANCH_BASE_NAME }}${i}"
git checkout $branch_name
git merge main --no-edit
git push ${REMOTE_NAME} $branch_name
git checkout main
done