Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add gh auth token fallback to top ranking issues script (#55028)
Joseph T. Lyons9beeed084ba2
diff --git a/script/update_top_ranking_issues/main.py b/script/update_top_ranking_issues/main.pyindex 0b71d0bb864..717f1394300 100644--- a/script/update_top_ranking_issues/main.py+++ b/script/update_top_ranking_issues/main.py@@ -1,4 +1,5 @@import os+import subprocessfrom datetime import date, datetime, timedeltafrom typing import Any, Optional@@ -39,9 +40,15 @@ def main(# but we can place it in our env when running the script locally, for conveniencetoken = github_token or os.getenv("GITHUB_ACCESS_TOKEN")if not token:- raise typer.BadParameter(- "GitHub token is required. Pass --github-token or set GITHUB_ACCESS_TOKEN env var."- )+ try:+ result = subprocess.run(+ ["gh", "auth", "token"], capture_output=True, text=True, check=True+ )+ token = result.stdout.strip()+ except (subprocess.CalledProcessError, FileNotFoundError):+ raise typer.BadParameter(+ "GitHub token is required. Pass --github-token, set GITHUB_ACCESS_TOKEN env var, or log in with `gh auth login`."+ )headers = {"Authorization": f"token {token}",