Skip to content

Commit

Permalink
🐛 Fixed self_upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: nullqwertyuiop <[email protected]>
  • Loading branch information
nullqwertyuiop committed Jan 29, 2023
1 parent 8947f75 commit 33766ef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shared/utils/self_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def get_current_branch(repo: Repo) -> Head:
def get_github_repo(repo: Repo) -> str:
remote_url = repo.remote().url
remote_url += "" if remote_url.endswith(".git") else ".git"
return re.search(r"(?<=github.com/).+?(?=\.git)", remote_url).group()
if github_match := re.search(r"(?<=github.com[/:]).+?(?=\.git)", remote_url):
return github_match.group()
raise RuntimeError("无法获取 GitHub 仓库地址,请检查当前目录是否为克隆自 GitHub 的 Git 仓库")


async def get_remote_commit_sha(repo: str, branch: str) -> str:
Expand Down Expand Up @@ -113,9 +115,7 @@ async def check_update():
message = message.replace("<", r"\<").splitlines()[0]
output.append(f"<red>{sha}</red> <yellow>{message}</yellow>")
history = "\n".join(["", *output, ""])
logger.opt(colors=True).warning(
f"<yellow>发现新版本</yellow>\n{history}"
)
logger.opt(colors=True).warning(f"<yellow>发现新版本</yellow>\n{history}")
if not config.auto_upgrade:
return
logger.opt(colors=True).info("<cyan>正在自动更新</cyan>")
Expand Down

0 comments on commit 33766ef

Please sign in to comment.