Skip to content

Commit

Permalink
Refactor config_util.py to handle gitlab host input
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbobo2021 committed May 22, 2024
1 parent 14b3197 commit 62b450d
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions merico/pr/config_util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json
import os

from lib.chatmark import TextEditor, Radio

from lib.chatmark import Radio, TextEditor

cache_repo_types = {}


# 根据PR URL获取不同的仓库管理类型
# 支持的类型有:github gitlab bitbucket bitbucket_server azure codecommit gerrit
def get_repo_type(url):
Expand All @@ -27,29 +28,21 @@ def get_repo_type(url):
return cache_repo_types[url]
else:
radio = Radio(
[
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit"
],
["github", "gitlab", "bitbucket", "bitbucket_server", "azure", "codecommit", "gerrit"],
)
radio.render()
if radio.selection is None:
return ""

rtype = [
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit"
][radio.selection]
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit",
][radio.selection]
cache_repo_types[url] = rtype
return rtype

Expand Down

0 comments on commit 62b450d

Please sign in to comment.