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 11name : MLC core actions test
2+ permissions :
3+ contents : read
24
35on :
46 pull_request :
@@ -327,3 +329,9 @@ jobs:
327329 mlc help rm cache
328330 mlc help search cache
329331 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 77import shutil
88from . import utils
99from .logger import logger
10+ from urllib .parse import urlparse
1011
1112class RepoAction (Action ):
1213 """
@@ -85,7 +86,8 @@ def add(self, run_args):
8586 if not os .path .exists (i_repo_path ):
8687 #check if its an URL
8788 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" :
8991 res = self .github_url_to_user_repo_format (i_repo_path )
9092 if res ['return' ] > 0 :
9193 return res
@@ -197,12 +199,18 @@ def find(self, run_args):
197199 repo_uid = repo_split [1 ]
198200 elif "@" in repo :
199201 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
206214
207215 # Check if repo_name exists in repos.json
208216 matched_repo_path = None
You can’t perform that action at this time.
0 commit comments