From 557dffaf6bf4d25fd95fc7f243167f920b23be29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9D=A6?= Date: Thu, 20 Mar 2025 13:46:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=20update=5Ffiles.py?= =?UTF-8?q?=20=E4=BB=A5=E5=A7=8B=E7=BB=88=E6=A0=87=E8=AE=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=BA=E5=B7=B2=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=9C=A8=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E4=B8=AD=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E4=B8=BB=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update_files.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update_files.py b/update_files.py index 189c41b..31be79a 100644 --- a/update_files.py +++ b/update_files.py @@ -21,7 +21,7 @@ def main(): print("list.yaml 文件不存在。") sys.exit(0) - modified = False + modified = True for item in items: file_path = item.get("file") @@ -65,6 +65,7 @@ def main(): token = os.environ.get("REPO_TOKEN") new_repo_url = repo_url.replace("https://", f"https://oauth2:{token}@") subprocess.run(["git", "remote", "set-url", "origin", new_repo_url], check=True) + subprocess.run(["git", "checkout", "-B", "main"], check=True) subprocess.run(["git", "add", "."], check=True) commit_message = "自动更新:从 list.yaml 下载最新文件" # 如果没有变更,则 git commit 会返回非零状态,可用 || true 处理