From 4927e292341e86a144cda52fa4cb8221d1496a72 Mon Sep 17 00:00:00 2001 From: Codebuddy Date: Wed, 30 Sep 2026 13:08:01 +0800 Subject: [PATCH] =?utf8?q?feat:=20=E4=BB=BB=E5=8A=A1=E6=B8=85=E5=8D=95?= =?utf8?q?=E8=87=AA=E5=8A=A8=20commit=20=E5=90=8E=E5=90=8C=E6=AD=A5=20push?= =?utf8?q?=20=E5=88=B0=20github=EF=BC=88=E4=BD=BF=E7=94=A8=E6=96=B0=20toke?= =?utf8?q?n=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- backend/app.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/app.py b/backend/app.py index eeb6cdd..f001f47 100644 --- a/backend/app.py +++ b/backend/app.py @@ -239,7 +239,7 @@ def _tasks_git_rel() -> str: def _git_commit_tasks() -> None: - """保存任务清单后自动提交到 git。失败仅告警,不影响接口正常返回。""" + """保存任务清单后自动提交到 git,并同步推送到 github。失败仅告警,不影响接口正常返回。""" try: with _GIT_LOCK: subprocess.run(["git", "add", "--", _tasks_git_rel()], cwd=_REPO_ROOT, @@ -249,6 +249,13 @@ def _git_commit_tasks() -> None: # 无实际变更时 git commit 返回非 0,忽略 if r.returncode == 0: logger.info("任务清单已自动 git commit") + # 同步推送到 github(令牌写在 remote URL 中) + p = subprocess.run(["git", "push", "github", "master"], + cwd=_REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + if p.returncode == 0: + logger.info("任务清单已自动 git push 到 github") + else: + logger.warning("任务清单 git push 到 github 失败(本地 commit 已保留)") except Exception as e: logger.warning(f"任务清单 git commit 失败(文件已保存): {e}") -- 2.43.0