carrot/.github/workflows/sync-branches.yml
机械小鸽 3a3c9e7ee3
Update sync-branches.yml
v7-wip5-ndv2
2025-01-03 16:47:47 +08:00

97 lines
4.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 v7-wip5-ndv2
- name: Sync v7-wip5-ndv2 carrot2-v6 branch from ajouatom/openpilot
run: |
git branch -r | grep "origin/v7-wip5-ndv2" && git push origin --delete v7-wip5-ndv2 || echo "No conflict with v7-wip5-ndv2 carrot2-v6"
git checkout -b v7-wip5-ndv2 ajouatom/v7-wip5-ndv2
git push origin v7-wip5-ndv2
# Add remote for commaai/openpilot
- name: Add remote for commaai/openpilot
run: |
git remote add commaai https://github.com/commaai/openpilot.git
git fetch commaai release3
# Sync release3 branch from commaai/openpilot to release3
- name: Sync release3 branch
run: |
git branch -r | grep "origin/release3" && git push origin --delete release3 || echo "No conflict with release3"
git checkout -b release3 commaai/release3
git push origin release3