Spaces:
Sleeping
Sleeping
Update langgraph_pr_review_bot.py
Browse files- langgraph_pr_review_bot.py +16 -3
langgraph_pr_review_bot.py
CHANGED
|
@@ -40,6 +40,19 @@ git_hub_token = user_secrets.get_secret("GITHUB_token_ID")
|
|
| 40 |
google_api_key = user_secrets.get_secret("GOOGLE_API_KEY")
|
| 41 |
'''
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
import os
|
| 44 |
from typing import Dict, Any, List, Optional, Tuple # Ensure Tuple is imported
|
| 45 |
from github import Github, PullRequest
|
|
@@ -78,8 +91,8 @@ def fetch_pr_code_changes(repo_name: str, pr_id: int) -> Tuple[Optional[str], Op
|
|
| 78 |
- head_commit_sha (str or None): The SHA of the head commit of the PR.
|
| 79 |
- error_message (str or None): An error message if something went wrong.
|
| 80 |
"""
|
| 81 |
-
|
| 82 |
-
github_token = git_hub_token
|
| 83 |
|
| 84 |
if not github_token:
|
| 85 |
print("Error: GITHUB_TOKEN environment variable not set.")
|
|
@@ -626,7 +639,7 @@ def post_review_comments_on_github(
|
|
| 626 |
Raises an exception on failure.
|
| 627 |
"""
|
| 628 |
if github_token is None:
|
| 629 |
-
github_token = os.getenv("
|
| 630 |
if github_token is None:
|
| 631 |
logging.error("GitHub token not provided and GITHUB_TOKEN environment variable not set.")
|
| 632 |
raise ValueError("GitHub token not provided and GITHUB_TOKEN environment variable not set.")
|
|
|
|
| 40 |
google_api_key = user_secrets.get_secret("GOOGLE_API_KEY")
|
| 41 |
'''
|
| 42 |
|
| 43 |
+
google_api_key = os.getenv("GOOGLE_API_KEY")
|
| 44 |
+
if not google_api_key:
|
| 45 |
+
print("Google API key not found in environment variables.")
|
| 46 |
+
return "Google API key not found. Please set GOOGLE_API_KEY environment variable.", None
|
| 47 |
+
print(f"Using Google API key: {google_api_key[:4]}... (truncated for security)")
|
| 48 |
+
|
| 49 |
+
git_hub_token = os.getenv("GITHUB_token_ID")
|
| 50 |
+
if not git_hub_token:
|
| 51 |
+
print("git_hub_token not found in environment variables.")
|
| 52 |
+
return "git_hub_token not found. Please set git_hub_token environment variable.", None
|
| 53 |
+
print(f"git_hub_token : {git_hub_token[:4]}... (truncated for security)")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
import os
|
| 57 |
from typing import Dict, Any, List, Optional, Tuple # Ensure Tuple is imported
|
| 58 |
from github import Github, PullRequest
|
|
|
|
| 91 |
- head_commit_sha (str or None): The SHA of the head commit of the PR.
|
| 92 |
- error_message (str or None): An error message if something went wrong.
|
| 93 |
"""
|
| 94 |
+
github_token = os.getenv("GITHUB_token_ID")
|
| 95 |
+
#github_token = git_hub_token
|
| 96 |
|
| 97 |
if not github_token:
|
| 98 |
print("Error: GITHUB_TOKEN environment variable not set.")
|
|
|
|
| 639 |
Raises an exception on failure.
|
| 640 |
"""
|
| 641 |
if github_token is None:
|
| 642 |
+
github_token = os.getenv("GITHUB_token_ID")
|
| 643 |
if github_token is None:
|
| 644 |
logging.error("GitHub token not provided and GITHUB_TOKEN environment variable not set.")
|
| 645 |
raise ValueError("GitHub token not provided and GITHUB_TOKEN environment variable not set.")
|