diff --git a/.github/workflows/check_domains.yml b/.github/workflows/check_domains.yml index 637d81e538..ee3d58e63f 100644 --- a/.github/workflows/check_domains.yml +++ b/.github/workflows/check_domains.yml @@ -65,37 +65,38 @@ jobs: run: | import requests import time - + def check_domain_redirection(domain, prefix, max_attempts=3): """Check if the given domain redirects correctly, with delays between retries.""" valid_destinations = ["ultralytics.com", "yolo11.com"] url = f"https://{prefix}{domain}" print(f"\nChecking {url}") - + for attempt in range(max_attempts): try: if attempt > 0: - time.sleep(2) # Simple 2-second delay between retries - + delay = 2 ** attempt # 2, 4, 8 seconds... + time.sleep(delay) + response = requests.get(url, allow_redirects=True, timeout=10) response.raise_for_status() - + if any(dest in response.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 ❌") 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]