Skip to content

Commit a36095d

Browse files
committed
ci: add Lychee link checker for the docs
Adds a daily (and manually dispatchable) Lychee workflow that builds the docs and checks the generated HTML for broken links, and flips onBrokenLinks/onBrokenMarkdownLinks to 'throw' so broken internal links fail the docs build. Mirrors the apify-docs setup.
1 parent a4de527 commit a36095d

3 files changed

Lines changed: 85 additions & 2 deletions

File tree

.github/workflows/lychee.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Periodic link checker
2+
3+
on:
4+
# Run daily at midnight UTC.
5+
schedule:
6+
- cron: '0 0 * * *'
7+
# Allow manual triggering from the GitHub UI.
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
NODE_VERSION: 22
15+
PYTHON_VERSION: 3.14
16+
17+
jobs:
18+
link_check:
19+
name: Link check
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v6
25+
26+
- name: Set up Node
27+
uses: actions/setup-node@v6
28+
with:
29+
node-version: ${{ env.NODE_VERSION }}
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v6
33+
with:
34+
python-version: ${{ env.PYTHON_VERSION }}
35+
36+
- name: Set up uv package manager
37+
uses: astral-sh/setup-uv@v8.2.0
38+
with:
39+
python-version: ${{ env.PYTHON_VERSION }}
40+
41+
- name: Install Python dependencies
42+
run: uv run poe install-dev
43+
44+
- name: Install pnpm and website dependencies
45+
uses: apify/actions/pnpm-install@v1.2.0
46+
with:
47+
working-directory: website
48+
49+
- name: Build docs
50+
run: uv run poe build-docs
51+
env:
52+
APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }}
53+
SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }}
54+
55+
- name: Run Lychee link checker
56+
id: lychee
57+
uses: lycheeverse/lychee-action@v2.8.0
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
60+
with:
61+
fail: true
62+
args: >
63+
--base https://docs.apify.com
64+
--max-retries 6
65+
--verbose
66+
--no-progress
67+
--timeout '60'
68+
--accept '100..=103,200..=299,429'
69+
--max-redirects 5
70+
--format markdown
71+
'./website/build/**/*.html'

.lycheeignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
http:\/\/localhost:3000.*
2+
https:\/\/www\.youtube.*
3+
\.(jpg|jpeg|png|gif|bmp|webp|svg)$
4+
https:\/\/github\.com\/apify\/apify-sdk-python\/edit\/[^ ]*
5+
https:\/\/docs\.apify\.com\/assets\/[^ ]*
6+
https:\/\/api\.apify\.com/.*
7+
file:\/\/\/.*
8+
https://chrome\.google\.com/webstore/.*
9+
https?:\/\/(www\.)?npmjs\.com\/.*
10+
^https://apify\.com/og-image.*
11+
https://console-backend.apify.com/
12+
https://mcp.apify.com/

website/docusaurus.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ module.exports = {
6060
},
6161
},
6262
onBrokenLinks:
63-
/** @type {import('@docusaurus/types').ReportingSeverity} */ ('warn'),
63+
/** @type {import('@docusaurus/types').ReportingSeverity} */ ('throw'),
6464
onBrokenMarkdownLinks:
65-
/** @type {import('@docusaurus/types').ReportingSeverity} */ ('warn'),
65+
/** @type {import('@docusaurus/types').ReportingSeverity} */ ('throw'),
6666
themes: [
6767
[
6868
'@apify/docs-theme',

0 commit comments

Comments
 (0)