Skip to content

🔄 Sync all branches with main #2

🔄 Sync all branches with main

🔄 Sync all branches with main #2

Workflow file for this run

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