-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.49 KB
/
docs-pr-check.yml
File metadata and controls
49 lines (41 loc) · 1.49 KB
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
46
47
48
49
name: Docs PR Check
on:
pull_request:
branches: [main]
jobs:
docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect docs changes
id: docs_changes
run: |
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
if git diff --name-only "$BASE" "$HEAD" | grep -E '^(docs/|\.github/workflows/docs-pr-check\.yml$)'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-node@v4
if: steps.docs_changes.outputs.changed == 'true'
with:
node-version: 22
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install docs dependencies
if: steps.docs_changes.outputs.changed == 'true'
run: npm ci
working-directory: docs
- name: Build docs
if: steps.docs_changes.outputs.changed == 'true'
run: npm run docs:build
working-directory: docs
- name: Check generated links
if: steps.docs_changes.outputs.changed == 'true'
run: npx --yes linkinator docs/.vitepress/dist --recurse --silent --skip '^https?://' --skip '^mailto:' --skip '^tel:'
- name: Skip message
if: steps.docs_changes.outputs.changed != 'true'
run: echo "No docs changes detected; skipping docs build/link checks."