@@ -78,7 +78,8 @@ def _build_contribution_graph_from_git(repo_path: str = ".") -> list:
7878 # Get commit dates
7979 result = subprocess .run (
8080 ['git' , 'log' , '--pretty=format:%ai' , '--all' ],
81- capture_output = True , text = True , cwd = repo_path
81+ capture_output = True , text = True , cwd = repo_path ,
82+ env = {** os .environ , 'GH_TOKEN' : os .getenv ('GH_TOKEN' )}
8283 )
8384 if result .returncode != 0 :
8485 return []
@@ -130,8 +131,9 @@ def __init__(self, token: Optional[str] = None):
130131 Initialize the GitHub fetcher.
131132
132133 Args:
133- token: Optional GitHub personal access token (ignored, uses gh CLI)
134+ token: Optional GitHub personal access token
134135 """
136+ self .token = token
135137 pass
136138
137139 def _check_gh_cli (self ) -> None :
@@ -214,7 +216,8 @@ def _gh_api(self, endpoint: str, method: str = "GET") -> Any:
214216 ['gh' , 'api' , endpoint , '-X' , method ],
215217 capture_output = True ,
216218 text = True ,
217- timeout = 30
219+ timeout = 30 ,
220+ env = {** os .environ , 'GH_TOKEN' : os .getenv ('GH_TOKEN' )}
218221 )
219222 if result .returncode != 0 :
220223 raise Exception (f"gh api failed: { result .stderr } " )
@@ -438,7 +441,8 @@ def _search_items(self, query: str, per_page: int = 5) -> Dict[str, Any]:
438441 cmd ,
439442 capture_output = True ,
440443 text = True ,
441- timeout = 30
444+ timeout = 30 ,
445+ env = {** os .environ , 'GH_TOKEN' : os .getenv ('GH_TOKEN' )}
442446 )
443447 if result .returncode != 0 :
444448 return {'total_count' : 0 , 'items' : []}
@@ -531,7 +535,7 @@ def _fetch_contribution_graph(self, username: str) -> list:
531535 # GraphQL query for contribution calendar (inline username)
532536 query = f'''{{
533537 user(login: "{ username } ") {{
534- contributionsCollection {{
538+ contributionsCollection(includePrivate: true) {{
535539 contributionCalendar {{
536540 weeks {{
537541 contributionDays {{
@@ -549,7 +553,8 @@ def _fetch_contribution_graph(self, username: str) -> list:
549553 ['gh' , 'api' , 'graphql' , '-f' , f'query={ query } ' ],
550554 capture_output = True ,
551555 text = True ,
552- timeout = 30
556+ timeout = 30 ,
557+ env = {** os .environ , 'GH_TOKEN' : os .getenv ('GH_TOKEN' )}
553558 )
554559
555560 if result .returncode != 0 :
@@ -641,7 +646,8 @@ def _api_request(self, endpoint: str) -> Any:
641646 cmd ,
642647 capture_output = True ,
643648 text = True ,
644- timeout = 30
649+ timeout = 30 ,
650+ env = {** os .environ , 'GH_TOKEN' : os .getenv ('GH_TOKEN' )}
645651 )
646652 if result .returncode != 0 :
647653 raise Exception (f"API request failed: { result .stderr } " )
0 commit comments