Skip to content

fix: relax github token + remote requirement on init #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2025
Merged
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
9 changes: 4 additions & 5 deletions src/codegen/cli/auth/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,16 @@
rich.print(format_command("export CODEGEN_SECRETS__GITHUB_TOKEN=<your-token>"))
rich.print("Or pass in as a parameter:")
rich.print(format_command("codegen init --token <your-token>"))
raise click.Abort()

if self.local_git.origin_remote is None:
rich.print("\n[bold red]Error:[/bold red] No remote found for repository")
rich.print("[white]Please add a remote to the repository.[/white]")
rich.print("\n[bold yellow]Warning:[/bold yellow] No remote found for repository")
rich.print("[white]To enable full functionality, please add a remote to the repository[/white]")
rich.print("\n[dim]To add a remote to the repository:[/dim]")
rich.print(format_command("git remote add origin <your-repo-url>"))
raise click.Abort()

try:
Github(login_or_token=git_token).get_repo(self.local_git.full_name)
if git_token is not None:
Github(login_or_token=git_token).get_repo(self.local_git.full_name)

Check failure on line 88 in src/codegen/cli/auth/session.py

View workflow job for this annotation

GitHub Actions / mypy

error: Argument 1 to "get_repo" of "Github" has incompatible type "str | None"; expected "int | str" [arg-type]
except BadCredentialsException:
rich.print(format_command(f"\n[bold red]Error:[/bold red] Invalid GitHub token={git_token} for repo={self.local_git.full_name}"))
rich.print("[white]Please provide a valid GitHub token for this repository.[/white]")
Expand Down
Loading