Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Validate data.json

on:
push:
branches: [main]
pull_request:

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip

- name: Install dependencies
run: pip install -r requirements.txt

- name: Regenerate data artifacts from doc_export.html
run: python data/convert_doc.py

- name: Check committed artifacts match regenerated output
run: |
git diff --exit-code \
data/data.json \
data/directory_data.json \
data/directory_structure.yaml \
dashboard/doc_styles.css

- name: Validate data.json against schema
run: python data/validate.py
4 changes: 3 additions & 1 deletion data/convert_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,16 @@ def remove_comments(tag):
current_h2_obj = None

elif el.name == 'h2':
if not text:
continue
if current_h1_obj and not current_h1_obj.get("special"):
current_h2_obj = {
"title": text,
"items": []
}
current_h1_obj["subsections"].append(current_h2_obj)
else:
current_h2_obj = None
current_h2_obj = None

elif el.name in ['p', 'ul', 'ol']:
if current_h1_obj and current_h1_obj.get("special"):
Expand Down
Loading