File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 1
1
name : MLC core actions test
2
+ permissions :
3
+ contents : read
2
4
3
5
on :
4
6
pull_request :
@@ -327,3 +329,9 @@ jobs:
327
329
mlc help rm cache
328
330
mlc help search cache
329
331
mlc help show cache
332
+ - name : MLC doc script
333
+ run : |
334
+ mlc pull repo mlcommons@mlperf-automations
335
+ mlc doc script --tags=detect,cpu
336
+ mlc doc script --all
337
+
Original file line number Diff line number Diff line change 7
7
import shutil
8
8
from . import utils
9
9
from .logger import logger
10
+ from urllib .parse import urlparse
10
11
11
12
class RepoAction (Action ):
12
13
"""
@@ -85,7 +86,8 @@ def add(self, run_args):
85
86
if not os .path .exists (i_repo_path ):
86
87
#check if its an URL
87
88
if utils .is_valid_url (i_repo_path ):
88
- if "github.com" in i_repo_path :
89
+ parsed = urlparse (i_repo_path )
90
+ if parsed .hostname == "github.com" :
89
91
res = self .github_url_to_user_repo_format (i_repo_path )
90
92
if res ['return' ] > 0 :
91
93
return res
@@ -197,12 +199,18 @@ def find(self, run_args):
197
199
repo_uid = repo_split [1 ]
198
200
elif "@" in repo :
199
201
repo_name = repo
200
- elif "github.com" in repo :
201
- result = self .github_url_to_user_repo_format (repo )
202
- if result ["return" ] == 0 :
203
- repo_name = result ["value" ]
204
- else :
205
- return result
202
+ else :
203
+ # Check for valid github.com URL using urlparse
204
+ try :
205
+ parsed = urlparse (repo )
206
+ except Exception :
207
+ parsed = None
208
+ if parsed and parsed .scheme in ("http" , "https" ) and parsed .hostname == "github.com" :
209
+ result = self .github_url_to_user_repo_format (repo )
210
+ if result ["return" ] == 0 :
211
+ repo_name = result ["value" ]
212
+ else :
213
+ return result
206
214
207
215
# Check if repo_name exists in repos.json
208
216
matched_repo_path = None
You can’t perform that action at this time.
0 commit comments