98 lines
3.7 KiB
YAML
98 lines
3.7 KiB
YAML
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
|
||
git fetch moretore mazda-frogpilot-0.9.6 # 同步 mazda-frogpilot-0.9.6 分支
|
||
|
||
- 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 if it exists
|
||
run: |
|
||
git branch -r | grep "origin/mazda-frogpilot" && git push origin --delete mazda-frogpilot || echo "No conflict with mazda-frogpilot"
|
||
|
||
- name: Create and push mazda-frogpilot branch
|
||
run: |
|
||
git checkout -b mazda-frogpilot moretore/mazda-frogpilot
|
||
git push origin mazda-frogpilot
|
||
|
||
- name: Delete conflicting branch mazda-frogpilot-0.9.6 if it exists
|
||
run: |
|
||
git branch -r | grep "origin/mazda-frogpilot-0.9.6" && git push origin --delete mazda-frogpilot-0.9.6 || echo "No conflict with mazda-frogpilot-0.9.6"
|
||
|
||
- name: Create and push mazda-frogpilot-0.9.6 branch
|
||
run: |
|
||
git checkout -b mazda-frogpilot-0.9.6 moretore/mazda-frogpilot-0.9.6
|
||
git push origin mazda-frogpilot-0.9.6
|
||
|
||
- 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
|