Skip to content

Commit 64287c1

Browse files
committed
ci: add markdown lint and link check workflows with configs (P3-21)
1 parent fe1a7e4 commit 64287c1

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

.github/workflows/docs-lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docs Lint & Links
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
markdownlint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Run markdownlint-cli2
14+
uses: DavidAnson/markdownlint-cli2-action@v16
15+
with:
16+
globs: |
17+
**/*.md
18+
config: .markdownlint.jsonc
19+
20+
link-check:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Run lychee link checker
25+
uses: lycheeverse/lychee-action@v1
26+
with:
27+
args: |
28+
--config .lychee.toml \
29+
--verbose \
30+
**/*.md
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.lychee.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Lychee link checker configuration
2+
# See https://github.com/lycheeverse/lychee
3+
4+
# Exclude common transient or rate-limited hosts
5+
exclude = [
6+
"https://img.shields.io/",
7+
"https://badgen.net/",
8+
"https://github.com/capgemini/template-github-copilot/actions",
9+
]
10+
11+
# Accept 429/403 as warnings instead of failures for rate-limited hosts
12+
accept = [429, 403]
13+
14+
# Request options
15+
user_agent = "lychee-link-checker"
16+
max_concurrency = 20
17+
18+
# Treat mailto and anchors as valid without network requests
19+
accept_pattern = [
20+
"^mailto:",
21+
"^#",
22+
]

.markdownlint.jsonc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// General rules
3+
"default": true,
4+
5+
// Allow long lines in docs for readability tables/links (disable MD013)
6+
"MD013": false,
7+
8+
// Allow inline HTML for badges and diagrams (MD033)
9+
"MD033": {
10+
"allowed_elements": ["img", "br", "a", "details", "summary"]
11+
},
12+
13+
// Require first heading to be a top-level H1
14+
"MD002": true,
15+
16+
// Disallow trailing spaces except in code blocks
17+
"MD009": { "br_spaces": 0 },
18+
19+
// Enforce consistent unordered list markers
20+
"MD004": { "style": "dash" }
21+
}

0 commit comments

Comments
 (0)