File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class GithubClient:
25
25
@classmethod
26
26
def from_repo_config (cls , repo_config : RepoConfig ) -> Self :
27
27
gh_wrapper = cls ()
28
- gh_wrapper .read_client = gh_wrapper ._create_client_for_repo (repo_config ) # TODO: the read/write separation isn't necessary since it's just going to use the lowside vs the highside token
28
+ gh_wrapper .read_client = gh_wrapper ._create_client_for_repo (repo_config )
29
29
gh_wrapper ._write_client = gh_wrapper ._create_client_for_repo (repo_config )
30
30
return gh_wrapper
31
31
@@ -37,8 +37,8 @@ def from_token(cls, token: str | None = None) -> Self:
37
37
gh_wrapper ._write_client = Github (token , base_url = cls .base_url )
38
38
return gh_wrapper
39
39
40
- def _create_client_for_repo (self ) -> Github :
41
- token = get_token_for_repo_config (github_type = self .type )
40
+ def _create_client_for_repo (self , repo_config : RepoConfig ) -> Github :
41
+ token = get_token_for_repo_config (repo_config = repo_config , github_type = self .type )
42
42
return Github (token , base_url = self .base_url )
43
43
44
44
def _get_client_for_scope (self , github_scope : GithubScope ) -> Github :
Original file line number Diff line number Diff line change 2
2
3
3
from codegen .git .configs .config import config
4
4
from codegen .git .schemas .github import GithubType
5
+ from codegen .git .schemas .repo_config import RepoConfig
5
6
6
7
logger = logging .getLogger (__name__ )
7
8
8
9
9
- def get_token_for_repo_config (github_type : GithubType = GithubType .GithubEnterprise ) -> str :
10
+ def get_token_for_repo_config (repo_config : RepoConfig , github_type : GithubType = GithubType .GithubEnterprise ) -> str :
10
11
# TODO: implement config such that we can retrieve tokens for different repos
11
12
if github_type == GithubType .GithubEnterprise :
12
13
return config .LOWSIDE_TOKEN
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def get_authenticated_clone_url_for_repo_config(
24
24
github_type : GithubType = GithubType .GithubEnterprise ,
25
25
) -> str :
26
26
git_url = get_clone_url_for_repo_config (repo , github_type )
27
- token = get_token_for_repo_config (github_type = github_type )
27
+ token = get_token_for_repo_config (repo_config = repo , github_type = github_type )
28
28
return f"https://x-access-token:{ token } @{ git_url } "
29
29
30
30
You can’t perform that action at this time.
0 commit comments