Skip to content

Commit

Permalink
Attach GITHUB_TOKEN to releases request if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Nov 7, 2024
1 parent 4a66106 commit 07e4c87
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions comfy_cli/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ def execute(
if version != "nightly":
try:
checkout_stable_comfyui(version=version, repo_dir=repo_dir)
except Exception as e:
except GitHubRateLimitError as e:
rprint(f"[bold red]Error checking out ComfyUI version: {e}[/bold red]")
sys.exit(1)

elif not check_comfy_repo(repo_dir)[0]:
rprint(
f"[bold red]'{repo_dir}' already exists. But it is an invalid ComfyUI repository. Remove it and retry.[/bold red]"
)
exit(-1)
sys.exit(-1)

# checkout specified commit
if commit is not None:
Expand Down Expand Up @@ -297,7 +297,11 @@ def fetch_github_releases(repo_owner: str, repo_name: str) -> List[Dict[str, str
"""
url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases"

response = requests.get(url, timeout=5)
headers = {}
if github_token := os.getenv("GITHUB_TOKEN"):
headers["Authorization"] = f"Bearer {github_token}"

response = requests.get(url, headers=headers, timeout=5)

# Handle rate limiting
if response.status_code in (403, 429):
Expand Down

0 comments on commit 07e4c87

Please sign in to comment.