diff --git a/.github/workflows/check_domains.yml b/.github/workflows/check_domains.yml index 6d9bb85a96..fd2f411a86 100644 --- a/.github/workflows/check_domains.yml +++ b/.github/workflows/check_domains.yml @@ -6,7 +6,7 @@ name: Check Domains on: schedule: # Runs every day at 05:00 UTC - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: jobs: @@ -15,46 +15,60 @@ jobs: strategy: fail-fast: false matrix: - domain: ["ultralytics.com", "ultralitics.com", "ultralytics.ai", "ultralytics.app", "ultralytics.eu", "ultralytics.es", "ultralytics.io", "ultralytics.net", "ultralytics.org", "yolov5.com", "pjreddie.org", "pjreddie.net"] + domain: + [ + "ultralytics.com", + "ultralitics.com", + "ultralytics.ai", + "ultralytics.app", + "ultralytics.eu", + "ultralytics.es", + "ultralytics.io", + "ultralytics.net", + "ultralytics.org", + "yolov5.com", + "pjreddie.org", + "pjreddie.net", + ] prefix: ["www.", ""] steps: - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install requests - - name: Check domain redirections - shell: python - run: | - 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. - """ - 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: - 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 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests + - name: Check domain redirections + shell: python + run: | + 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. + """ + 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: + 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 }}'") + 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 diff --git a/.github/workflows/download_websites.yml b/.github/workflows/download_websites.yml index 8572cb7b61..d13fdeaf73 100644 --- a/.github/workflows/download_websites.yml +++ b/.github/workflows/download_websites.yml @@ -6,7 +6,7 @@ name: Download Websites on: workflow_dispatch: schedule: - - cron: '0 0 * * *' # runs at 00:00 UTC every day + - cron: "0 0 * * *" # runs at 00:00 UTC every day push: branches: - gh-pages diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 81e10187dd..ce7ff4f403 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -6,9 +6,9 @@ name: Ultralytics Actions on: push: - branches: [main,master] + branches: [main, master] pull_request: - branches: [main,master] + branches: [main, master] jobs: format: diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index de6ae990cf..be2fa95e3a 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -12,7 +12,7 @@ name: Check Broken links on: workflow_dispatch: schedule: - - cron: '0 0 * * *' # runs at 00:00 UTC every day + - cron: "0 0 * * *" # runs at 00:00 UTC every day push: branches: - main @@ -27,12 +27,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - branch: [main, gh-pages] # Define the branches to test + branch: [main, gh-pages] # Define the branches to test steps: - name: Checkout code uses: actions/checkout@v4 with: - ref: ${{ matrix.branch }} # Use matrix to check out the correct branch + ref: ${{ matrix.branch }} # Use matrix to check out the correct branch - name: Download and install lychee run: | diff --git a/.github/workflows/sitemaps.yml b/.github/workflows/sitemaps.yml index 77703bb6e5..d4652ee65d 100644 --- a/.github/workflows/sitemaps.yml +++ b/.github/workflows/sitemaps.yml @@ -24,13 +24,13 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 with: - ref: gh-pages # checkout gh-pages branch - fetch-depth: 2 # fetch the current and previous commit + ref: gh-pages # checkout gh-pages branch + fetch-depth: 2 # fetch the current and previous commit - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: "3.x" - name: Install Dependencies run: | @@ -78,7 +78,7 @@ jobs: import os import re import requests - + def submit_urls_to_indexnow(host, urls): key = os.environ['INDEXNOW_KEY'] endpoint = "https://api.indexnow.org/indexnow" # static API endpoint from https://www.indexnow.org/faq @@ -92,7 +92,7 @@ jobs: print(f"Failed to submit batch of URLs: Status code {response.status_code}, Response: {response.text}") except Exception as e: print(f"ERROR ❌: Failed to submit batch of URLs - {e}") - + def extract_urls_from_sitemap(sitemap_url): try: response = requests.get(sitemap_url) @@ -100,7 +100,7 @@ jobs: except Exception as e: print(f"ERROR ❌: Failed to extract URLs from {sitemap_url} - {e}") return [] - + def filter_modified_urls(urls, modified_files): # Filter URLs based on modified files modified_urls = [] @@ -110,7 +110,7 @@ jobs: if full_url in urls: modified_urls.append(full_url) return modified_urls - + # Submit URLs from each sitemap to IndexNow host = "docs.ultralytics.com" all_urls = [] diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index cc7fde6aea..dd8503541e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -3,7 +3,7 @@ name: Close stale issues on: schedule: - - cron: '0 0 * * *' # Runs at 00:00 UTC every day + - cron: "0 0 * * *" # Runs at 00:00 UTC every day jobs: stale: @@ -43,5 +43,5 @@ jobs: days-before-issue-close: 10 days-before-pr-stale: 90 days-before-pr-close: 30 - exempt-issue-labels: 'documentation,tutorial,TODO' - operations-per-run: 300 # The maximum number of operations per run, used to control rate limiting. + exempt-issue-labels: "documentation,tutorial,TODO" + operations-per-run: 300 # The maximum number of operations per run, used to control rate limiting. diff --git a/README.md b/README.md index 7bc64c29f5..b03541e32d 100644 --- a/README.md +++ b/README.md @@ -49,13 +49,13 @@ mkdocs serve - #### Command Breakdown: - - `mkdocs` is the main MkDocs command-line interface. - - `serve` is the subcommand to build and locally serve your documentation. + - `mkdocs` is the main MkDocs command-line interface. + - `serve` is the subcommand to build and locally serve your documentation. - 🧐 Note: - - Grasp changes to the docs in real-time as `mkdocs serve` supports live reloading. - - To stop the local server, press `CTRL+C`. + - Grasp changes to the docs in real-time as `mkdocs serve` supports live reloading. + - To stop the local server, press `CTRL+C`. ## 🌍 Building and Serving Multi-Language