Skip to content

Commit e2cdf0d

Browse files
revert repo config removal
1 parent 2bd4c3c commit e2cdf0d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/codegen/git/clients/github_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GithubClient:
2525
@classmethod
2626
def from_repo_config(cls, repo_config: RepoConfig) -> Self:
2727
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)
2929
gh_wrapper._write_client = gh_wrapper._create_client_for_repo(repo_config)
3030
return gh_wrapper
3131

@@ -37,8 +37,8 @@ def from_token(cls, token: str | None = None) -> Self:
3737
gh_wrapper._write_client = Github(token, base_url=cls.base_url)
3838
return gh_wrapper
3939

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)
4242
return Github(token, base_url=self.base_url)
4343

4444
def _get_client_for_scope(self, github_scope: GithubScope) -> Github:

src/codegen/git/configs/token.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
from codegen.git.configs.config import config
44
from codegen.git.schemas.github import GithubType
5+
from codegen.git.schemas.repo_config import RepoConfig
56

67
logger = logging.getLogger(__name__)
78

89

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:
1011
# TODO: implement config such that we can retrieve tokens for different repos
1112
if github_type == GithubType.GithubEnterprise:
1213
return config.LOWSIDE_TOKEN

src/codegen/git/utils/clone_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_authenticated_clone_url_for_repo_config(
2424
github_type: GithubType = GithubType.GithubEnterprise,
2525
) -> str:
2626
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)
2828
return f"https://x-access-token:{token}@{git_url}"
2929

3030

0 commit comments

Comments
 (0)