fix: git commit 不依赖 files_written,遍历 repos/ 下所有仓库自动提交
This commit is contained in:
parent
4fe5f17490
commit
d35800a100
@ -761,14 +761,16 @@ async def role_agent_run(project_id, role, agent_id=None, model_name=None):
|
||||
"created_by": agent_id or role,
|
||||
})
|
||||
|
||||
# Git commit + push
|
||||
# Git commit + push(遍历 repos/ 下所有仓库,不依赖 files_written——agent 可能直接用 write_file 写代码而不走 deliver.files)
|
||||
commit_msg = deliverable.get("git_commit_message") or f"{role}: {title[:80]}"
|
||||
git_result = {"rc": 0, "message": "无git操作"}
|
||||
if files_written:
|
||||
for repo_name in os.listdir(repos_dir):
|
||||
repo_path = os.path.join(repos_dir, repo_name)
|
||||
if os.path.isdir(os.path.join(repo_path, '.git')):
|
||||
git_result = await _git_commit_push(repo_path, commit_msg)
|
||||
git_results = []
|
||||
for repo_name in sorted(os.listdir(repos_dir)):
|
||||
repo_path = os.path.join(repos_dir, repo_name)
|
||||
if os.path.isdir(os.path.join(repo_path, '.git')):
|
||||
r = await _git_commit_push(repo_path, commit_msg)
|
||||
git_results.append(f"{repo_name}: {r.get('message', '')}")
|
||||
logger.info(f"git_commit_push {repo_name}: rc={r.get('rc', -1)} {r.get('message', '')[:100]}")
|
||||
git_result = {"rc": 0, "message": "; ".join(git_results) if git_results else "无仓库可提交"}
|
||||
|
||||
await sor.sqlExe(
|
||||
"UPDATE pipeline_tasks SET state=${st}$, claimed_by=NULL WHERE id=${tid}$",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user