Skip to content

Commit d435cc5

Browse files
fix: remote git repo doesn't need token if it's public repo (#775)
1 parent 91d767e commit d435cc5

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,13 @@ repos:
8080
rev: 39.169.3
8181
hooks:
8282
- id: renovate-config-validator
83+
8384
- repo: https://github.com/astral-sh/uv-pre-commit
8485
rev: "0.5.31"
8586
hooks:
8687
- id: uv-sync
8788
args: ["--frozen", "--all-packages", "--all-extras"]
8889

89-
- repo: "local"
90-
hooks:
91-
# Disabled as part of LFS removal.
92-
# - id: disallowed-words-check
93-
# name: Check for disallowed words
94-
# entry: scripts/disallowed-words-check.sh
95-
# language: script
96-
# files: '' # Check all files
97-
- id: generate-runner-imports
98-
name: Generate Runner Imports
99-
entry: bash -c "uv run --frozen python -m codegen.gscli.cli generate runner-imports src/codegen/shared/compilation/function_imports.py"
100-
language: system
101-
pass_filenames: false
102-
always_run: true
103-
10490
- repo: https://github.com/hukkin/mdformat
10591
rev: 0.7.22 # Use the ref you want to point at
10692
hooks:

src/codegen/git/repo_operator/repo_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from codegen.git.clients.git_repo_client import GitRepoClient
2121
from codegen.git.configs.constants import CODEGEN_BOT_EMAIL, CODEGEN_BOT_NAME
2222
from codegen.git.repo_operator.local_git_repo import LocalGitRepo
23-
from codegen.git.schemas.enums import CheckoutResult, FetchResult, SetupOption
23+
from codegen.git.schemas.enums import CheckoutResult, FetchResult, RepoVisibility, SetupOption
2424
from codegen.git.schemas.repo_config import RepoConfig
2525
from codegen.git.utils.clone import clone_or_pull_repo, clone_repo, pull_repo
2626
from codegen.git.utils.clone_url import add_access_token_to_url, get_authenticated_clone_url_for_repo_config, get_clone_url_for_repo_config, url_to_github
@@ -89,7 +89,7 @@ def repo_path(self) -> str:
8989

9090
@property
9191
def remote_git_repo(self) -> GitRepoClient:
92-
if not self.access_token:
92+
if not self.access_token and self.repo_config.visibility != RepoVisibility.PUBLIC:
9393
msg = "Must initialize with access_token to get remote"
9494
raise ValueError(msg)
9595

0 commit comments

Comments
 (0)