Sync Fork with Upstream #9773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Fork with Upstream | |
on: | |
# Runs every 5 minutes | |
schedule: | |
- cron: "*/5 * * * *" | |
# Allow manual trigger | |
workflow_dispatch: | |
jobs: | |
sync: | |
name: Sync with upstream | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Add upstream remote | |
run: | | |
git remote add upstream https://github.com/elizaOS/eliza.git | |
git remote -v | |
- name: Fetch upstream | |
run: git fetch upstream | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git config pull.rebase true | |
# Sync main branch | |
- name: Sync main branch | |
run: | | |
git checkout main | |
git pull origin main | |
git merge upstream/main | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | |
# Add sync develop branch | |
- name: Sync develop branch | |
run: | | |
git fetch origin develop | |
git checkout develop || git checkout -b develop | |
git pull origin develop | |
git merge upstream/develop | |
git push origin develop | |
env: | |
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | |
# Updated to merge both main and develop into sif-dev | |
- name: Merge into sif-dev | |
run: | | |
git fetch origin sif-dev | |
git checkout sif-dev | |
git pull origin sif-dev | |
# Try to merge main into sif-dev | |
git merge main --strategy-option ours || { | |
git merge --abort | |
git reset --hard | |
git merge -X ours main | |
} | |
# Try to merge develop into sif-dev | |
git merge develop --strategy-option ours || { | |
git merge --abort | |
git reset --hard | |
git merge -X ours develop | |
} | |
git push origin sif-dev | |
env: | |
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} |