Skip to content

Commit

Permalink
Update check_domains.yml (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Oct 26, 2024
1 parent a4b3e54 commit 68092c8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/check_domains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
"pjreddie.org",
"pjreddie.net",
"yolov5.com",
"yolo11.com",
"yolo11.ai",
"yolo11.io",
"yolo11.net",
Expand All @@ -53,30 +54,34 @@ jobs:
import requests
def check_domain_redirection(domain, prefix, max_attempts=3):
"""
Check if the given domain redirects to ultralytics.com correctly, with up to 3 retries.
"""
"""Check if the given domain redirects correctly, with up to 3 retries."""
valid_destinations = ["ultralytics.com", "yolo11.com"]
url = f"https://{prefix}{domain}"
print(f"\nChecking {url}")
for attempt in range(max_attempts):
try:
response = requests.get(url, allow_redirects=True)
response.raise_for_status()
final_url = response.url
if "ultralytics.com" in final_url and response.status_code == 200:
# Check if the final URL contains any of the valid destinations
if any(dest in final_url for dest in valid_destinations) and response.status_code == 200:
print("Success ✅")
return True
except requests.RequestException as e:
print(f"Error: {e}")
if attempt == max_attempts - 1:
print(f"Failed after {max_attempts} attempts ❌.")
print(f"Failed after {max_attempts} attempts ❌")
return False
return False
success = check_domain_redirection('${{ matrix.domain }}', '${{ matrix.prefix }}')
if not success:
raise Exception(f"Domain check failed for ${{ matrix.domain }} with prefix '${{ matrix.prefix }}'")
Summary:
runs-on: ubuntu-latest
needs: [Test] # Add job names that you want to check for failure
Expand Down

0 comments on commit 68092c8

Please sign in to comment.