Skip to content

Commit c576e36

Browse files
committed
ci: add GitHub Actions workflow for documentation validation
1 parent e50d0c5 commit c576e36

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

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+
push:
5+
branches: [ main, master ]
6+
paths:
7+
- '/*.md'
8+
- '/*.markdown'
9+
- '/*.asc'
10+
- '/*.adoc'
11+
- '.github/workflows/docs-validation.yml'
12+
- '.docs-validator.toml'
13+
14+
pull_request:
15+
branches: [ main, master ]
16+
paths:
17+
- '/*.md'
18+
- '/*.markdown'
19+
- '/*.asc'
20+
- '/*.adoc'
21+
- '.github/workflows/docs-validation.yml'
22+
- '.docs-validator.toml'
23+
24+
workflow_dispatch:
25+
inputs:
26+
target_path:
27+
description: 'Path to scan'
28+
required: false
29+
default: '.'
30+
fail_on_error:
31+
description: 'Fail pipeline on errors'
32+
required: false
33+
type: boolean
34+
default: true
35+
36+
jobs:
37+
validate-docs:
38+
name: Validate Documentation Links
39+
runs-on: ubuntu-24.04
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: '3.13'
48+
49+
- name: Install docs-validator
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install git+https://github.com/Nokhrin/docs-validator.git
53+
54+
- name: Run documentation validation
55+
run: |
56+
FAIL_FLAG=""
57+
if [ "${{ github.event.inputs.fail_on_error }}" = "true" ] || [ -z "${{ github.event.inputs.fail_on_error }}" ]; then
58+
FAIL_FLAG="--fail-on-error"
59+
fi
60+
TARGET_PATH="${{ github.event.inputs.target_path || '.' }}"
61+
docs-validator scan "$TARGET_PATH" --validate $FAIL_FLAG --report markdown --output docs-validation-report.md
62+
63+
- name: Upload validation report
64+
if: always()
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: docs-validation-report
68+
path: docs-validation-report.md
69+
retention-days: 7

0 commit comments

Comments
 (0)