Skip to content

Commit 8260c1b

Browse files
author
Evans Castonguay
committed
refactor: guard missing GitLab clone token
1 parent ca4882d commit 8260c1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pr_agent/git_providers/gitlab_provider.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,7 @@ def generate_link_to_relevant_line_number(self, suggestion) -> str:
956956
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
957957
access_token = getattr(self.gl, 'oauth_token', None) or getattr(self.gl, 'private_token', None)
958958
if not access_token:
959-
get_logger().error("No access token found for GitLab clone.")
960-
return None
959+
return self._log_missing_clone_token()
961960

962961
# Note: GitLab instances are not always hosted under a gitlab.* domain.
963962
# Build a clone URL that works with any host (e.g., gitlab.example.com).
@@ -994,3 +993,8 @@ def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
994993
artifact={"error": str(e)},
995994
)
996995
return None
996+
997+
@staticmethod
998+
def _log_missing_clone_token() -> None:
999+
get_logger().error("No access token found for GitLab clone.")
1000+
return None

0 commit comments

Comments
 (0)