Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test-mlc-core-actions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: MLC core actions test
permissions:
contents: read

on:
pull_request:
Expand Down Expand Up @@ -327,3 +329,9 @@ jobs:
mlc help rm cache
mlc help search cache
mlc help show cache
- name: MLC doc script
run: |
mlc pull repo mlcommons@mlperf-automations
mlc doc script --tags=detect,cpu
mlc doc script --all

22 changes: 15 additions & 7 deletions mlc/repo_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import shutil
from . import utils
from .logger import logger
from urllib.parse import urlparse

class RepoAction(Action):
"""
Expand Down Expand Up @@ -85,7 +86,8 @@ def add(self, run_args):
if not os.path.exists(i_repo_path):
#check if its an URL
if utils.is_valid_url(i_repo_path):
if "github.com" in i_repo_path:
parsed = urlparse(i_repo_path)
if parsed.hostname == "github.com":
res = self.github_url_to_user_repo_format(i_repo_path)
if res['return'] > 0:
return res
Expand Down Expand Up @@ -197,12 +199,18 @@ def find(self, run_args):
repo_uid = repo_split[1]
elif "@" in repo:
repo_name = repo
elif "github.com" in repo:
result = self.github_url_to_user_repo_format(repo)
if result["return"] == 0:
repo_name = result["value"]
else:
return result
else:
# Check for valid github.com URL using urlparse
try:
parsed = urlparse(repo)
except Exception:
parsed = None
if parsed and parsed.scheme in ("http", "https") and parsed.hostname == "github.com":
result = self.github_url_to_user_repo_format(repo)
if result["return"] == 0:
repo_name = result["value"]
else:
return result

# Check if repo_name exists in repos.json
matched_repo_path = None
Expand Down
Loading