Update pr_agent/git_providers/bitbucket_provider.py

Co-authored-by: Prateek <110811408+Prateikx@users.noreply.github.com>
This commit is contained in:
ChunTing Wu
2025-04-11 14:59:27 +08:00
committed by GitHub
parent c0c307503f
commit 0cbf65dab6

View File

@ -625,14 +625,15 @@ class BitbucketProvider(GitProvider):
get_logger().error(f"repo_url_to_clone: {repo_url_to_clone} is not a valid bitbucket URL.") get_logger().error(f"repo_url_to_clone: {repo_url_to_clone} is not a valid bitbucket URL.")
return None return None
if hasattr(self, 'basic_token'): if self.auth_type == "basic":
# Basic auth with token # Basic auth with token
clone_url = f"{scheme}x-token-auth:{self.basic_token}@bitbucket.org{base_url}" clone_url = f"{scheme}x-token-auth:{self.basic_token}@bitbucket.org{base_url}"
elif hasattr(self, 'bearer_token'): elif self.auth_type == "bearer":
# Bearer token # Bearer token
clone_url = f"{scheme}x-token-auth:{self.bearer_token}@bitbucket.org{base_url}" clone_url = f"{scheme}x-token-auth:{self.bearer_token}@bitbucket.org{base_url}"
else: else:
get_logger().error("No valid authentication method provided. Returning None") # This case should ideally not be reached if __init__ validates auth_type
get_logger().error(f"Unsupported or uninitialized auth_type: {getattr(self, 'auth_type', 'N/A')}. Returning None")
return None return None
return clone_url return clone_url