Skip to content

Commit a0d880b

Browse files
authored
Add automated documentation validation workflow (#8167)
* Add markdownlint, cspell, jslint and json-lint jobs * Make markdownlint config more lenient * copilot review fixes
1 parent 298c07b commit a0d880b

File tree

3 files changed

+228
-0
lines changed

3 files changed

+228
-0
lines changed

.github/cspell.json

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"version": "0.2",
3+
"language": "en",
4+
"caseSensitive": false,
5+
"words": [
6+
"CakePHP",
7+
"VitePress",
8+
"php",
9+
"datetime",
10+
"varchar",
11+
"postgresql",
12+
"mysql",
13+
"sqlite",
14+
"webroot",
15+
"csrf",
16+
"xss",
17+
"cakephp",
18+
"bake",
19+
"phinx",
20+
"hasher",
21+
"middlewares",
22+
"namespaced",
23+
"phpunit",
24+
"composable",
25+
"autowiring",
26+
"stringable",
27+
"arrayable",
28+
"timestampable",
29+
"paginator",
30+
"Enqueue",
31+
"dequeue",
32+
"nullable",
33+
"accessor",
34+
"mutator",
35+
"minphpversion",
36+
"phpversion",
37+
"XAMPP",
38+
"WAMP",
39+
"MAMP",
40+
"controllername",
41+
"actionname",
42+
"Datamapper",
43+
"webservices",
44+
"nginx",
45+
"apache",
46+
"httpd",
47+
"lighttpd",
48+
"mbstring",
49+
"simplexml",
50+
"Laragon",
51+
"composer",
52+
"phar",
53+
"paginate",
54+
"startup",
55+
"endfor",
56+
"endwhile",
57+
"sidebar",
58+
"blocks",
59+
"rewrite",
60+
"before",
61+
"called",
62+
"sites",
63+
"example",
64+
"Classes",
65+
"Redirect",
66+
"Layout"
67+
],
68+
"ignoreRegExpList": [
69+
"\\$[a-zA-Z_][a-zA-Z0-9_]*",
70+
"[a-zA-Z]+::[a-zA-Z]+",
71+
"<[^>]+>",
72+
"`[^`]+`",
73+
"```[\\s\\S]*?```",
74+
"\\b[A-Z][a-z]+(?:[A-Z][a-z]+)+\\b",
75+
"\\b[a-z]+_[a-z_]+\\b",
76+
"\\bhttps?:\\/\\/[^\\s]+",
77+
"\\[[a-z]\\][a-z]+",
78+
"\\b[A-Z][a-z]+\\b",
79+
"\\b(true|false|null|while|for|if|else)\\b"
80+
],
81+
"languageSettings": [
82+
{
83+
"languageId": "*",
84+
"locale": "en",
85+
"dictionaries": ["en", "softwareTerms", "php"]
86+
},
87+
{
88+
"languageId": "*",
89+
"locale": "ja",
90+
"allowCompoundWords": true
91+
}
92+
],
93+
"overrides": [
94+
{
95+
"filename": "**/docs/ja/**/*.md",
96+
"language": "ja",
97+
"ignoreRegExpList": [
98+
"[\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Han}]+"
99+
]
100+
}
101+
],
102+
"ignorePaths": [
103+
"node_modules/**",
104+
".temp/**",
105+
"dist/**",
106+
"**/*.min.js",
107+
"**/*.lock"
108+
]
109+
}

.github/markdownlint.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"default": true,
3+
"heading-increment": false,
4+
"no-hard-tabs": false,
5+
"no-multiple-blanks": false,
6+
"line-length": false,
7+
"commands-show-output": false,
8+
"blanks-around-headings": false,
9+
"no-duplicate-heading": false,
10+
"single-h1": false,
11+
"no-trailing-punctuation": false,
12+
"no-blanks-blockquote": false,
13+
"list-marker-space": false,
14+
"blanks-around-fences": false,
15+
"blanks-around-lists": false,
16+
"no-inline-html": {
17+
"allowed_elements": [
18+
"Badge",
19+
"div",
20+
"span",
21+
"br",
22+
"style",
23+
"details",
24+
"summary",
25+
"table",
26+
"thead",
27+
"tbody",
28+
"tr",
29+
"th",
30+
"td",
31+
"img",
32+
"a",
33+
"svg",
34+
"path",
35+
"figure",
36+
"p"
37+
]
38+
},
39+
"no-bare-urls": false,
40+
"fenced-code-language": false,
41+
"first-line-heading": false,
42+
"code-block-style": false,
43+
"single-trailing-newline": false,
44+
"link-fragments": false,
45+
"table-pipe-style": false,
46+
"table-column-count": false,
47+
"emphasis-style": false,
48+
"table-column-style": false,
49+
"descriptive-link-text": false
50+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Documentation Validation
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'docs/**'
7+
- '.github/**'
8+
- 'toc_*.json'
9+
- 'config.js'
10+
11+
jobs:
12+
js-lint:
13+
name: Validate JavaScript Files
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v5
19+
20+
- name: Validate config.js syntax
21+
run: node --check config.js
22+
23+
json-lint:
24+
name: Validate JSON Files
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
31+
- name: Validate JSON syntax
32+
run: |
33+
for file in toc_*.json; do
34+
if ! jq empty "$file" 2>/dev/null; then
35+
echo "Invalid JSON: $file"
36+
exit 1
37+
fi
38+
echo "✅ Valid: $file"
39+
done
40+
41+
markdown-lint:
42+
name: Lint Markdown
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v5
48+
49+
- name: Lint markdown files
50+
uses: articulate/actions-markdownlint@v1
51+
with:
52+
config: .github/markdownlint.json
53+
files: 'docs/**/*.md'
54+
ignore: 'node_modules'
55+
56+
spell-check:
57+
name: Spell Check
58+
runs-on: ubuntu-latest
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v5
63+
64+
- name: Check spelling
65+
uses: streetsidesoftware/cspell-action@v5
66+
with:
67+
files: 'docs/**/*.md'
68+
config: '.github/cspell.json'
69+
incremental_files_only: true

0 commit comments

Comments
 (0)