diff --git a/.agent/utils/gitbucket/add_comment.py b/.agent/utils/gitbucket/add_comment.py index fd53415..80d1666 100644 --- a/.agent/utils/gitbucket/add_comment.py +++ b/.agent/utils/gitbucket/add_comment.py @@ -7,7 +7,17 @@ def add_comment(issue_number, body, repo="yangyangxie/cortex-hub"): token = os.getenv("GITBUCKET_TOKEN") if not token: - print("Error: GITBUCKET_TOKEN environment variable not set.") + # Try to load from .env.gitbucket + env_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))), ".env.gitbucket") + if os.path.exists(env_path): + with open(env_path, 'r') as f: + for line in f: + if line.startswith("GITBUCKET_TOKEN="): + token = line.split("=")[1].strip() + break + + if not token: + print("Error: GITBUCKET_TOKEN not found in environment or .env.gitbucket.") sys.exit(1) url = f"https://gitbucket.jerxie.com/api/v3/repos/{repo}/issues/{issue_number}/comments" diff --git a/.agent/utils/gitbucket/create_issue.py b/.agent/utils/gitbucket/create_issue.py index 09d497f..6116285 100644 --- a/.agent/utils/gitbucket/create_issue.py +++ b/.agent/utils/gitbucket/create_issue.py @@ -7,7 +7,17 @@ def create_issue(title, body, repo="yangyangxie/cortex-hub"): token = os.getenv("GITBUCKET_TOKEN") if not token: - print("Error: GITBUCKET_TOKEN environment variable not set.") + # Try to load from .env.gitbucket + env_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))), ".env.gitbucket") + if os.path.exists(env_path): + with open(env_path, 'r') as f: + for line in f: + if line.startswith("GITBUCKET_TOKEN="): + token = line.split("=")[1].strip() + break + + if not token: + print("Error: GITBUCKET_TOKEN not found in environment or .env.gitbucket.") sys.exit(1) url = f"https://gitbucket.jerxie.com/api/v3/repos/{repo}/issues"