feat: 修改 update_files.py 以始终标记文件为已修改,并在自动更新中切换到主分支
This commit is contained in:
@@ -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 处理
|
||||
|
||||
Reference in New Issue
Block a user