Sync Fork with Upstream #1
This file contains hidden or 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: | |
| schedule: | |
| # Run daily at 00:00 UTC | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Add upstream remote | |
| run: | | |
| git remote add upstream https://github.com/open-webui/open-webui.git || true | |
| git fetch upstream | |
| - name: Sync main branch | |
| run: | | |
| git checkout main | |
| git merge upstream/main --no-edit || { | |
| echo "Merge conflict detected on main branch" | |
| git merge --abort | |
| exit 1 | |
| } | |
| # Remove upstream's docker-build.yaml to prevent duplicate/unwanted builds | |
| if [ -f .github/workflows/docker-build.yaml ]; then | |
| rm .github/workflows/docker-build.yaml | |
| git add .github/workflows/docker-build.yaml | |
| git commit -m "chore: remove upstream docker-build.yaml (using custom ARM64 workflow)" || true | |
| fi | |
| git push origin main | |
| - name: Sync dev branch | |
| run: | | |
| git checkout dev | |
| git merge upstream/dev --no-edit || { | |
| echo "Merge conflict detected on dev branch" | |
| git merge --abort | |
| exit 1 | |
| } | |
| # Remove upstream's docker-build.yaml to prevent duplicate/unwanted builds | |
| if [ -f .github/workflows/docker-build.yaml ]; then | |
| rm .github/workflows/docker-build.yaml | |
| git add .github/workflows/docker-build.yaml | |
| git commit -m "chore: remove upstream docker-build.yaml (using custom ARM64 workflow)" || true | |
| fi | |
| git push origin dev |