-
Notifications
You must be signed in to change notification settings - Fork 2.6k
124 lines (104 loc) · 3.04 KB
/
docs-validation.yml
File metadata and controls
124 lines (104 loc) · 3.04 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Documentation Validation
on:
push:
branches:
- 5.x
- 6.x
- 5.next
paths:
- 'docs/**'
- '.github/**'
- 'toc_*.json'
- 'config.js'
pull_request:
paths:
- 'docs/**'
- '.github/**'
- 'toc_*.json'
- 'config.js'
jobs:
js-lint:
name: Validate JavaScript Files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Validate config.js syntax
run: node --check config.js
json-lint:
name: Validate JSON Files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Validate JSON syntax
run: |
for file in toc_*.json; do
if ! jq empty "$file" 2>/dev/null; then
echo "Invalid JSON: $file"
exit 1
fi
echo "✅ Valid: $file"
done
toc-link-check:
name: Validate TOC Links
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Check TOC links exist
run: node bin/check-toc-links.js
markdown-lint:
name: Lint Markdown
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Lint markdown files
uses: DavidAnson/markdownlint-cli2-action@v22
with:
config: './.github/.markdownlint-cli2.jsonc'
globs: 'docs/**/*.md'
spell-check:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Check spelling
uses: streetsidesoftware/cspell-action@v8
with:
files: 'docs/**/*.md'
config: '.github/cspell.json'
incremental_files_only: true
link-check:
name: Check Internal Links
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed markdown files
id: changed-files
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
# Get files changed in PR
FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true)
if [ -z "$FILES" ]; then
echo "No markdown files changed"
echo "files=" >> $GITHUB_OUTPUT
else
# Convert to space-separated list for script
echo "files=$(echo $FILES | tr '\n' ' ')" >> $GITHUB_OUTPUT
echo "Checking files:"
echo "$FILES"
fi
else
# For push events, check all files using glob pattern
echo 'files="docs/**/*.md"' >> $GITHUB_OUTPUT
echo 'Checking all files: docs/**/*.md'
fi
- name: Check internal links
if: steps.changed-files.outputs.files != ''
run: node bin/check-links.js --baseline .github/linkchecker-baseline.json ${{ steps.changed-files.outputs.files }}