Skip to content

Commit ca3c319

Browse files
committed
ci(docs): add lychee link check and markdownlint workflows with config
1 parent f65ef74 commit ca3c319

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-0
lines changed

.github/workflows/link-check.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docs Link Check
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
paths:
7+
- '**/*.md'
8+
- '.github/workflows/link-check.yml'
9+
- 'lychee.toml'
10+
workflow_dispatch: {}
11+
12+
concurrency:
13+
group: link-check-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
lychee:
18+
name: Check links with lychee
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Run lychee link checker
25+
uses: lycheeverse/lychee-action@v2
26+
with:
27+
# Respect config file settings; output summary and fail on broken links
28+
args: >-
29+
--config lychee.toml
30+
--no-progress
31+
--max-redirects 10
32+
--timeout 20
33+
--retry-wait-time 2
34+
--max-retries 2
35+
--format detailed
36+
--exclude-mail
37+
**/*.md
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Upload lychee report (always)
42+
if: always()
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: lychee-report
46+
path: |
47+
lychee-out.md
48+
lychee-out.txt
49+
lychee-cache*

.github/workflows/markdownlint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Markdown Lint
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
paths:
7+
- '**/*.md'
8+
- '.github/workflows/markdownlint.yml'
9+
- '.markdownlint.jsonc'
10+
push:
11+
branches: [ master ]
12+
paths:
13+
- '.markdownlint.jsonc'
14+
workflow_dispatch: {}
15+
16+
concurrency:
17+
group: mdlint-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
markdownlint:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Use Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
32+
- name: Install markdownlint-cli2
33+
run: |
34+
npm install -g markdownlint-cli2
35+
36+
- name: Run markdownlint
37+
run: |
38+
markdownlint-cli2 "**/*.md" "!**/bin/**" "!**/obj/**" || exit 1

.markdownlint.jsonc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Base rules
3+
"default": true,
4+
5+
// Line length: allow long URLs/tables
6+
"MD013": false,
7+
8+
// Multiple headings with same content are OK in long guides
9+
"MD024": false,
10+
11+
// Allow inline HTML (for mermaid, badges, etc.)
12+
"MD033": false,
13+
14+
// Allow duplicate headers across files
15+
"MD025": {
16+
"level": 1,
17+
"front_matter_title": "^$"
18+
},
19+
20+
// Require blank line before/after lists for readability
21+
"MD032": true,
22+
23+
// Emphasis used sparingly; allow current style
24+
"MD036": false,
25+
26+
// Links: allow reference-style or inline
27+
"MD011": true
28+
}

lychee.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# lychee configuration for docs link checking
2+
# See https://github.com/lycheeverse/lychee for options
3+
4+
# Inputs are passed via action arguments (/**/*.md)
5+
6+
# Cache to speed up repeated runs
7+
cache = true
8+
max_cache_age = "2d"
9+
10+
# Treat HTTP 429 as a warning by retrying and not failing the job
11+
retry_wait_time = 2
12+
max_retries = 2
13+
14+
# Timeouts
15+
timeout = 20
16+
17+
# Exclusions: private/internal or known transient domains
18+
exclude = [
19+
"mailto:",
20+
"^#", # page anchors handled by renderer
21+
"https://aka.ms/.*", # shortlinks often redirect
22+
"https://help.github.com/.*",
23+
]
24+
25+
# Accept some status codes as valid (e.g., 429 throttling)
26+
accept = [200, 201, 202, 203, 204, 206, 300, 301, 302, 303, 307, 308]
27+
28+
# GitHub API token for rate limits (provided by action)
29+
[github]
30+
# use token from env
31+
32+
# Output report files
33+
[output]
34+
format = "detailed"
35+
save = "lychee-out.txt"

0 commit comments

Comments
 (0)