Skip to content

Commit 0b34195

Browse files
feat(ci): add schema validation
1 parent 13fd54d commit 0b34195

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Validate Schemas
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/*.yaml'
7+
- '**/*.yml'
8+
- '.schemas/**/*.json'
9+
pull_request:
10+
paths:
11+
- '**/*.yaml'
12+
- '**/*.yml'
13+
- '.schemas/**/*.json'
14+
15+
jobs:
16+
validate:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
26+
- name: Install ajv-cli
27+
run: npm install -g ajv-cli
28+
29+
- name: Validate JSON Schemas
30+
run: |
31+
# First validate that our schema files are valid JSON Schema
32+
for schema in .schemas/*.json; do
33+
echo "Validating schema file: $schema"
34+
ajv compile -s http://json-schema.org/draft-07/schema -c $schema
35+
done
36+
37+
- name: Validate YAML Files
38+
run: |
39+
# Install yaml parsing tools
40+
npm install -g yaml-validator
41+
42+
# Validate development.yaml files against schema
43+
for file in **/development.yaml; do
44+
echo "Validating: $file"
45+
yaml-validator -s .schemas/development.json $file
46+
done
47+
48+
# Validate hosting.yaml files against schema
49+
for file in **/hosting.yaml; do
50+
echo "Validating: $file"
51+
yaml-validator -s .schemas/hosting.json $file
52+
done

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,7 @@ See [.schemas/hosting.json](.schemas/hosting.json) for the complete schema.
4949
### Schema Validation
5050

5151
The repository includes JSON Schema definitions in the `.schemas/` directory that provide validation and autocompletion in VSCode while editing the YAML files with the "YAML" VSCode extension by Red Had installed.
52+
53+
### Continuous Integration
54+
55+
A GitHub Actions workflow automatically validates all YAML files against their respective schemas on every push and pull request that modifies YAML or schema files. This ensures that all configuration files remain valid as changes are made.

0 commit comments

Comments
 (0)