File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ def get_current_branch(repo: Repo) -> Head:
34
34
def get_github_repo (repo : Repo ) -> str :
35
35
remote_url = repo .remote ().url
36
36
remote_url += "" if remote_url .endswith (".git" ) else ".git"
37
- return re .search (r"(?<=github.com/).+?(?=\.git)" , remote_url ).group ()
37
+ if github_match := re .search (r"(?<=github.com[/:]).+?(?=\.git)" , remote_url ):
38
+ return github_match .group ()
39
+ raise RuntimeError ("无法获取 GitHub 仓库地址,请检查当前目录是否为克隆自 GitHub 的 Git 仓库" )
38
40
39
41
40
42
async def get_remote_commit_sha (repo : str , branch : str ) -> str :
@@ -113,9 +115,7 @@ async def check_update():
113
115
message = message .replace ("<" , r"\<" ).splitlines ()[0 ]
114
116
output .append (f"<red>{ sha } </red> <yellow>{ message } </yellow>" )
115
117
history = "\n " .join (["" , * output , "" ])
116
- logger .opt (colors = True ).warning (
117
- f"<yellow>发现新版本</yellow>\n { history } "
118
- )
118
+ logger .opt (colors = True ).warning (f"<yellow>发现新版本</yellow>\n { history } " )
119
119
if not config .auto_upgrade :
120
120
return
121
121
logger .opt (colors = True ).info ("<cyan>正在自动更新</cyan>" )
You can’t perform that action at this time.
0 commit comments