Update links.yml to run checks on https://ultralytics.com #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ultralytics YOLO 🚀, AGPL-3.0 license | |
# YOLO Continuous Integration (CI) GitHub Actions tests broken link checker | |
# Accept 429(Instagram, 'too many requests'), 999(LinkedIn, 'unknown status code'), Timeout(Twitter) | |
name: Check Broken links | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # runs at 00:00 UTC every day | |
push: | |
branches: | |
- main | |
- gh-pages | |
pull_request: | |
branches: | |
- main | |
- gh-pages | |
jobs: | |
Links: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
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 | |
- name: Download and install lychee | |
run: | | |
LYCHEE_URL=$(curl -s https://api.github.com/repos/lycheeverse/lychee/releases/latest | grep "browser_download_url" | grep "x86_64-unknown-linux-gnu.tar.gz" | cut -d '"' -f 4) | |
curl -L $LYCHEE_URL -o lychee.tar.gz | |
tar xzf lychee.tar.gz | |
sudo mv lychee /usr/local/bin | |
- name: Test Markdown and HTML links with retry | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: lychee --accept 429,999 --exclude-loopback --exclude 'https?://(www\.)?(linkedin\.com|twitter\.com|instagram\.com|kaggle\.com|fonts\.gstatic\.com|url\.com)' --exclude-path '**/ci.yaml' --exclude-mail --github-token ${{ secrets.GITHUB_TOKEN }} './**/*.md' './**/*.html' | |
- name: Test Markdown, HTML, YAML, Python and Notebook links with retry | |
if: github.event_name == 'workflow_dispatch' | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: lychee --accept 429,999 --exclude-loopback --exclude 'https?://(www\.)?(linkedin\.com|twitter\.com|instagram\.com|kaggle\.com|url\.com|fonts\.gstatic\.com|url\.com)' --exclude-path '**/ci.yaml' --exclude-mail --github-token ${{ secrets.GITHUB_TOKEN }} './**/*.md' './**/*.html' './**/*.yml' './**/*.yaml' './**/*.py' './**/*.ipynb' | |
- name: Download Ultralytics Website | |
if: matrix.branch == 'main' | |
run: | | |
mkdir ultralytics_website | |
wget -P ultralytics_website --recursive --no-parent -A html --adjust-extension https://www.ultralytics.com | |
- name: Run Broken Link Checks on Ultralytics Website | |
if: matrix.branch == 'main' | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: lychee --accept 429,999 --exclude-loopback --exclude 'https?://(www\.)?(linkedin\.com|twitter\.com|instagram\.com|kaggle\.com|url\.com|fonts\.gstatic\.com|url\.com)' --exclude-path '**/ci.yaml' --exclude-mail --github-token ${{ secrets.GITHUB_TOKEN }} './ultralytics_website/**/*.html' | |