diff --git a/tools/component_tools/static_check/csct_online_prehandle.py b/tools/component_tools/static_check/csct_online_prehandle.py index 1a823cfc378007d970e669d281f91dd93acf6121..459b87d821732345726e8ab3c01459543fb35efa 100755 --- a/tools/component_tools/static_check/csct_online_prehandle.py +++ b/tools/component_tools/static_check/csct_online_prehandle.py @@ -142,7 +142,11 @@ def strip_diff(diff_dict: dict, pull_request_url: str, gitee_pr_diff: str): def get_diff_by_repo_pr_num(repo_url: str, pr_num: int): - diff_url = "%spulls/%s.diff" % (repo_url, str(pr_num)) + if repo_url.find('gitcode.com') == -1: + diff_url = "%spulls/%s.diff" % (repo_url, str(pr_num)) + else: + repo_url_api = repo_url.replace('https://gitcode.com',"https://api.gitcode.com/api/v5/repos") + diff_url = "%spulls/%s/diff" % (repo_url_api, str(pr_num)) + "?access_token=nszZCFTs_HNKDWnuH6sfrBxf" cmd = "curl -L -s " + diff_url gitee_pr_diff = "" try: @@ -170,7 +174,10 @@ class GiteeCsctPrehandler: repo_pr_num_list = pr_list.split(";") for pr_item in repo_pr_num_list: - pr_split_group = pr_item.split("pulls/") + if pr_item.find('gitcode.com') == -1: + pr_split_group = pr_item.split("pulls/") + else: + pr_split_group = pr_item.split("merge_requests/") repo_url = pr_split_group[0].strip() pr_num = pr_split_group[1].strip("/")