Skip to content

Commit d6938f2

Browse files
Merge pull request #389 from nullqwertyuiop/Ariadne-v4
🐛 Fixed `self_upgrade`
2 parents cb1a96c + 3ed79e2 commit d6938f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: shared/utils/self_upgrade.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ def get_current_branch(repo: Repo) -> Head:
3434
def get_github_repo(repo: Repo) -> str:
3535
remote_url = repo.remote().url
3636
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 仓库")
3840

3941

4042
async def get_remote_commit_sha(repo: str, branch: str) -> str:
@@ -113,9 +115,7 @@ async def check_update():
113115
message = message.replace("<", r"\<").splitlines()[0]
114116
output.append(f"<red>{sha}</red> <yellow>{message}</yellow>")
115117
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}")
119119
if not config.auto_upgrade:
120120
return
121121
logger.opt(colors=True).info("<cyan>正在自动更新</cyan>")

0 commit comments

Comments
 (0)