mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 16:59:27 +08:00
Add sync branch
This commit is contained in:
41
.github/workflows/sync-branch.yml
vendored
Normal file
41
.github/workflows/sync-branch.yml
vendored
Normal file
@@ -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"
|
||||
@@ -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
|
||||
# ============================================
|
||||
|
||||
Reference in New Issue
Block a user