diff --git a/.devops/monitor.py b/.devops/monitor.py index 2ce0f1a..f3638b1 100644 --- a/.devops/monitor.py +++ b/.devops/monitor.py @@ -160,7 +160,14 @@ class GitMonitor: Logger.error("拉取主仓库失败") return False - # 更新所有子模块 + # 初始化和更新所有子模块(包括新增的子模块) + cmd = "git submodule update --init --recursive" + result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True) + if result.returncode != 0: + Logger.error("初始化子模块失败") + return False + + # 更新所有子模块到最新代码 cmd = f"git submodule foreach 'git checkout {self.global_branch} && git pull'" result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True) if result.returncode != 0: