@@ -27,6 +27,7 @@ class RemoteRepoOperator(RepoOperator):
27
27
# __init__ attributes
28
28
repo_config : RepoConfig
29
29
base_dir : str
30
+ github_type : GithubType
30
31
31
32
# lazy attributes
32
33
_remote_git_repo : GitRepoClient | None = None
@@ -43,6 +44,7 @@ def __init__(
43
44
github_type : GithubType = GithubType .GithubEnterprise ,
44
45
) -> None :
45
46
super ().__init__ (repo_config = repo_config , base_dir = base_dir )
47
+ self .github_type = github_type
46
48
self .setup_repo_dir (setup_option = setup_option , shallow = shallow )
47
49
48
50
####################################################################################################################
@@ -52,7 +54,7 @@ def __init__(
52
54
@property
53
55
def remote_git_repo (self ) -> GitRepoClient :
54
56
if not self ._remote_git_repo :
55
- self ._remote_git_repo = GitRepoClient (self .repo_config , access_scope = GithubScope .WRITE )
57
+ self ._remote_git_repo = GitRepoClient (self .repo_config , github_type = self . github_type , access_scope = GithubScope .WRITE )
56
58
return self ._remote_git_repo
57
59
58
60
@property
@@ -74,17 +76,17 @@ def codeowners_parser(self) -> CodeOwnersParser | None:
74
76
@override
75
77
def pull_repo (self ) -> None :
76
78
"""Pull the latest commit down to an existing local repo"""
77
- pull_repo (repo = self .repo_config , path = self .base_dir )
79
+ pull_repo (repo = self .repo_config , path = self .base_dir , github_type = self . github_type )
78
80
79
81
def clone_repo (self , shallow : bool = True ) -> None :
80
- clone_repo (repo = self .repo_config , path = self .base_dir , shallow = shallow )
82
+ clone_repo (repo = self .repo_config , path = self .base_dir , shallow = shallow , github_type = self . github_type )
81
83
82
84
def clone_or_pull_repo (self , shallow : bool = True ) -> None :
83
85
"""If repo exists, pulls changes. otherwise, clones the repo."""
84
86
# TODO(CG-7804): if repo is not valid we should delete it and re-clone. maybe we can create a pull_repo util + use the existing clone_repo util
85
87
if self .repo_exists ():
86
88
self .clean_repo ()
87
- clone_or_pull_repo (self .repo_config , path = self .base_dir , shallow = shallow )
89
+ clone_or_pull_repo (self .repo_config , path = self .base_dir , shallow = shallow , github_type = self . github_type )
88
90
89
91
def setup_repo_dir (self , setup_option : SetupOption = SetupOption .PULL_OR_CLONE , shallow : bool = True ) -> None :
90
92
os .makedirs (self .base_dir , exist_ok = True )
0 commit comments