From f7abd153efa42e226c2c15f9c75e48010a48a7ca Mon Sep 17 00:00:00 2001 From: Pancake <13051345080@163.com> Date: Fri, 9 Jan 2026 14:25:20 +0800 Subject: [PATCH] Add sync branch --- .github/workflows/sync-branch.yml | 41 +++++++++++++++++++++++++++++++ web/.env.local | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sync-branch.yml diff --git a/.github/workflows/sync-branch.yml b/.github/workflows/sync-branch.yml new file mode 100644 index 000000000..4d8234186 --- /dev/null +++ b/.github/workflows/sync-branch.yml @@ -0,0 +1,41 @@ +name: Sync Branch + +on: + # 每4小时自动运行 + schedule: + - cron: '0 */4 * * *' + # 允许手动触发 + workflow_dispatch: + +permissions: + contents: write + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + 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: Sync main to sync branch + run: | + # 检查 sync 分支是否存在 + if git ls-remote --heads origin sync | grep -q sync; then + echo "sync branch exists, updating..." + else + echo "sync branch does not exist, creating..." + fi + + # 强制将 main 分支的内容推送到 sync 分支 + git push origin main:sync --force + + echo "✅ Successfully synced main branch to sync branch" diff --git a/web/.env.local b/web/.env.local index 0b6543af3..8840a64d6 100644 --- a/web/.env.local +++ b/web/.env.local @@ -3,7 +3,7 @@ # ============================================ # This file is automatically updated based on config/main.yaml # and environment variables (NEXT_PUBLIC_API_BASE, NEXT_PUBLIC_API_BASE_EXTERNAL) -# +# # To configure for remote access, set in your .env file: # NEXT_PUBLIC_API_BASE=http://your-server-ip:8001 # ============================================