File size: 1,777 Bytes
47af768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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:
  push:
    branches: [master]
  pull_request:
    branches: [master]
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'  # runs at 00:00 UTC every day

jobs:
  Links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - 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 twitter.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 twitter.com,url.com --exclude-path '**/ci.yaml' --exclude-mail --github-token ${{ secrets.GITHUB_TOKEN }} './**/*.md' './**/*.html' './**/*.yml' './**/*.yaml' './**/*.py' './**/*.ipynb'