Checks if a GitHub repository exists. Raises an exception if not.
(git_repo_url)
| 99 | """ |
| 100 | return '\n'.join(line for line in text.split('\n') if line.strip()) |
| 101 | def validateRepository(git_repo_url): |
| 102 | """Checks if a GitHub repository exists. Raises an exception if not.""" |
| 103 | try: |
| 104 | response = requests.head(git_repo_url, allow_redirects=True, timeout=20) |
| 105 | response.raise_for_status() |
| 106 | except requests.exceptions.RequestException as e: |
| 107 | if "Not Found" in str(e): |
| 108 | raise Exception(f"No repository found with URL: {git_repo_url}. Kindly check the URL.") |
| 109 | raise Exception(f"Repository validation failed: {e}") |
| 110 | |
| 111 | def extractRepositoryName(git_repo_url): |
| 112 | """Extracts repository name from a GitHub URL""" |
no outgoing calls
no test coverage detected