diff --git a/pr_agent/git_providers/codecommit_provider.py b/pr_agent/git_providers/codecommit_provider.py index c4f1ed7bf9..30c894811d 100644 --- a/pr_agent/git_providers/codecommit_provider.py +++ b/pr_agent/git_providers/codecommit_provider.py @@ -13,6 +13,8 @@ from ..log import get_logger from .git_provider import GitProvider +_CODECOMMIT_HOSTNAME_PATTERN = re.compile(r"^[a-z]{2}-(gov-)?[a-z]+-\d\.console\.aws\.amazon\.com$") + class PullRequestCCMimic: """ @@ -359,7 +361,7 @@ def _is_valid_codecommit_hostname(hostname: str) -> bool: Returns: - bool: True if the hostname is valid, False otherwise. """ - return re.match(r"^[a-z]{2}-(gov-)?[a-z]+-\d\.console\.aws\.amazon\.com$", hostname) is not None + return _CODECOMMIT_HOSTNAME_PATTERN.match(hostname) is not None def _get_pr(self): response = self.codecommit_client.get_pr(self.repo_name, self.pr_num)