Compare commits

...

2 Commits

Author SHA1 Message Date
66511432ed 延长超时时间
Some checks failed
多仓库同步流水线 / sync-repositories (push) Failing after 13m0s
2025-11-23 22:43:36 +08:00
6161f2875d add repo 2025-11-22 21:44:21 +08:00
3 changed files with 34 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ on:
workflow_dispatch:
schedule:
# 每天凌晨1点执行
- cron: '0 1 * * *'
- cron: '0 1 * * 0'
env:
CONFIG_FILE: 'repos.yaml'

View File

@@ -1,16 +1,35 @@
# 多仓库同步配置文件
# 定义需要同步的仓库对,源仓库 -> 目标仓库
repositories:
# 示例:同步 BladeX-Tool 仓库
- name: "bladex-tool" # 仓库名称(用于日志输出)
- name: "bladex-tool"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/BladeX-Tool.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/BladeX-Tool.git"
branch: "master" # 要同步的分支
# 示例:同步另一个仓库(取消注释并修改以下配置)
# - name: "another-repo"
# source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@github.com/example/repo.git"
# target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/home/repo.git"
# branch: "main"
# 添加更多仓库同步配置...
branch: "master"
- name: "BladeX-Safety"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/BladeX-Safety.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/BladeX-Safety.git"
branch: "master"
- name: "bladex"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/BladeX.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/BladeX.git"
branch: "master"
- name: "BladeX-Doc"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/BladeX-Doc.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/BladeX-Doc.git"
branch: "master"
- name: "BladeX-Boot"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/BladeX-Boot.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/BladeX-Boot.git"
branch: "master"
- name: "Saber"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/Saber.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/Saber.git"
branch: "master"
- name: "BladeX-Biz"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/BladeX-Biz.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/BladeX-Biz.git"
branch: "master"
- name: "Saber3"
source_url: "https://${UPSTREAM_USERNAME}:${UPSTREAM_TOKEN}@center.javablade.com/blade/Saber3.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/BladeX/Saber3.git"
branch: "master"

View File

@@ -88,7 +88,7 @@ def sync_repository(repo_config):
print(f"\n[1/6] 克隆目标仓库...")
result = subprocess.run(
['git', 'clone', target_url, work_dir],
capture_output=True, text=True, timeout=300
capture_output=True, text=True, timeout=3600
)
if result.returncode != 0:
print(f"❌ 克隆目标仓库失败:")
@@ -112,7 +112,7 @@ def sync_repository(repo_config):
try:
result = subprocess.run(
['git', 'fetch', 'upstream'],
capture_output=True, text=True, timeout=200
capture_output=True, text=True, timeout=3600
)
if result.returncode == 0:
break
@@ -166,7 +166,7 @@ def sync_repository(repo_config):
print(f"[6/6] 推送到目标仓库...")
result = subprocess.run(
['git', 'push', '--force', '--tags', 'origin', f'refs/heads/{branch}'],
capture_output=True, text=True, timeout=600
capture_output=True, text=True, timeout=3600
)
if result.returncode != 0:
print(f"❌ 推送到目标仓库失败:")