Skip to content

Commit 9da6c02

Browse files
committed
Added link checker
1 parent 76df8ae commit 9da6c02

3 files changed

Lines changed: 168 additions & 0 deletions

File tree

.github/workflows/link_check.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Check documentation links"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- "[0-9]+.[0-9]+"
8+
workflow_dispatch: ~
9+
pull_request: ~
10+
11+
jobs:
12+
link-check:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: [3.13]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install MkDocs dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
31+
- name: Build documentation
32+
run: mkdocs build --strict
33+
34+
- name: Restore lychee cache
35+
uses: actions/cache@v4
36+
with:
37+
path: .lycheecache
38+
key: lychee-${{ github.ref_name }}-${{ hashFiles('lychee.toml') }}
39+
restore-keys: |
40+
lychee-${{ github.ref_name }}-
41+
lychee-
42+
43+
- name: Check links
44+
uses: lycheeverse/lychee-action@v2
45+
with:
46+
args: >-
47+
--config lychee.toml
48+
--cache
49+
--cache-exclude-status "500.."
50+
site
51+
fail: true
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Upload link-check report
56+
if: always()
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: lychee-report
60+
path: lychee-report.md
61+
if-no-files-found: ignore

lychee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 97a086a6900feaccf161fd03c23d26e2eaf02c4d

lychee.toml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
############################# Display #############################
2+
3+
# Verbose program output
4+
verbose = "warn"
5+
6+
# Output format
7+
format = "markdown"
8+
9+
# Path to report output file
10+
output = "lychee-report.md"
11+
12+
# Don't show interactive progress bar while checking links.
13+
no_progress = false
14+
15+
############################# Cache ###############################
16+
17+
# Enable link caching to avoid re-checking identical links across runs.
18+
cache = true
19+
20+
# Discard cached results older than this duration.
21+
max_cache_age = "1d"
22+
23+
############################# Runtime #############################
24+
25+
# Maximum number of allowed redirects.
26+
max_redirects = 10
27+
28+
# Maximum number of allowed retries before a link is declared dead.
29+
max_retries = 3
30+
31+
# Minimum wait time in seconds between retries of failed requests.
32+
retry_wait_time = 2
33+
34+
# Maximum number of concurrent link checks.
35+
max_concurrency = 16
36+
37+
############################# Requests ############################
38+
39+
# Website timeout from connect to response finished (seconds).
40+
timeout = 20
41+
42+
# Comma-separated list of accepted status codes for valid links.
43+
# 429 = Too Many Requests (rate-limited, treat as valid).
44+
accept = ["200", "429"]
45+
46+
# Proceed for server connections considered insecure (invalid TLS).
47+
insecure = false
48+
49+
# Only test links with these schemes.
50+
scheme = ["https", "http"]
51+
52+
# Request method
53+
method = "get"
54+
55+
# Enable the checking of anchor fragments in links.
56+
include_fragments = true
57+
58+
# Do NOT check links inside <code> and <pre> blocks.
59+
include_verbatim = false
60+
61+
############################# Exclusions ##########################
62+
63+
# Skip missing input files instead of erroring.
64+
skip_missing = false
65+
66+
# Exclude URLs from checking (treated as regular expressions).
67+
exclude = [
68+
# LinkedIn blocks automated requests
69+
"^https?://(www\\.)?linkedin\\.com",
70+
# Localhost and loopback addresses
71+
"^https?://localhost",
72+
"^https?://127\\.0\\.0\\.1",
73+
# Placeholder/example domains
74+
"^https?://example\\.com",
75+
# GitHub login/auth pages often rate-limit or redirect bots
76+
"^https?://github\\.com/login",
77+
# Internal documentation anchor-only references (handled by MkDocs build)
78+
"^#",
79+
]
80+
81+
# Exclude these paths from being checked.
82+
exclude_path = [
83+
# Generated search index and assets have no meaningful links
84+
"site/search",
85+
"site/assets",
86+
# 404 page
87+
"site/404.html",
88+
# Sitemap and robots files
89+
"site/sitemap.xml",
90+
"site/robots.txt",
91+
]
92+
93+
# Check the specified file extensions
94+
extensions = ["html"]
95+
96+
# Exclude all private IPs from checking.
97+
exclude_all_private = true
98+
99+
############################# Local files #########################
100+
101+
# Root path used to resolve absolute local links (e.g. /en/latest/page/).
102+
# Must match the directory passed as input to lychee.
103+
root_dir = "site"
104+
105+
# Base URL for resolving relative links in HTML files.
106+
base_url = "https://doc.ibexa.co/en/latest/"

0 commit comments

Comments
 (0)