name: Sync Branches on: schedule: # 每天10点UTC(你可以根据需要调整时区) - cron: '0 10 * * *' workflow_dispatch: # 允许手动启动工作流 jobs: sync: runs-on: ubuntu-latest steps: - name: Checkout the main repository uses: actions/checkout@v3 with: token: ${{ secrets.GH_TOKEN }} # 显式传递GH_TOKEN - name: Setup Git run: | git config --global user.name "GitHub Actions" git config --global user.email "github-actions@github.com" # Existing remotes and branches - name: Add remote for MoreTore/openpilot run: | git remote add moretore https://github.com/MoreTore/openpilot.git git fetch moretore mazda-frogpilot-dev - name: Add remote for FrogAi/FrogPilot run: | git remote add frogai https://github.com/FrogAi/FrogPilot.git git fetch frogai - name: Delete conflicting branch mazda-frogpilot-dev if it exists run: | git branch -r | grep "origin/mazda-frogpilot-dev" && git push origin --delete mazda-frogpilot-dev || echo "No conflict with mazda-frogpilot-dev" - name: Create and push mazda-frogpilot-dev branch run: | git checkout -b mazda-frogpilot-dev moretore/mazda-frogpilot-dev git push origin mazda-frogpilot-dev - name: Delete conflicting branch FrogPilot if it exists run: | git branch -r | grep "origin/FrogPilot" && git push origin --delete FrogPilot || echo "No conflict with FrogPilot" - name: Force fetch and reset FrogPilot branch from remote run: | git fetch --all git checkout --orphan FrogPilot git reset --hard frogai/FrogPilot git push origin FrogPilot --force - name: Delete conflicting branch FrogPilot-Development if it exists run: | git branch -r | grep "origin/FrogPilot-Development" && git push origin --delete FrogPilot-Development || echo "No conflict with FrogPilot-Development" - name: Force fetch and reset FrogPilot-Development branch from remote run: | git fetch --all git checkout --orphan FrogPilot-Development git reset --hard frogai/FrogPilot-Development git push origin FrogPilot-Development --force # New remotes and branches - name: Add remote for opgm/openpilot run: | git remote add opgm https://github.com/opgm/openpilot.git git fetch opgm staging - name: Sync staging branch from opgm/openpilot run: | git branch -r | grep "origin/staging" && git push origin --delete staging || echo "No conflict with staging" git checkout -b staging opgm/staging git push origin staging - name: Add remote for ajouatom/openpilot run: | git remote add ajouatom https://github.com/ajouatom/openpilot.git git fetch ajouatom carrot2-v6 - name: Sync carrot2-v6 branch from ajouatom/openpilot run: | git branch -r | grep "origin/carrot2-v6" && git push origin --delete carrot2-v6 || echo "No conflict with carrot2-v6" git checkout -b carrot2-v6 ajouatom/carrot2-v6 git push origin carrot2-v6