Skip to content

Commit a05b530

Browse files
add jsonschema (#112)
* init json schema validation * fix script name * test schema optimization * add git config * test username * add github token * Update optimizer_config.schema.json * remove test field * Update optimizer_config.schema.json * trigger only on main --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0de2afc commit a05b530

File tree

4 files changed

+1025
-1
lines changed

4 files changed

+1025
-1
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Generate JSON Schema
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
generate-schema:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
run: |
26+
pip install .
27+
28+
- name: Generate JSON Schema
29+
run: python scripts/generate_json_schema_config.py
30+
31+
- name: Check for changes
32+
id: check_changes
33+
run: |
34+
git diff --exit-code docs/optimizer_config.schema.json || echo "changed=true" >> $GITHUB_ENV
35+
36+
- name: Commit and push changes
37+
if: env.changed == 'true'
38+
env:
39+
GITHUB_TOKEN: ${{ github.token }}
40+
run: |
41+
git config --global user.name "github-actions[bot]"
42+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
43+
git add docs/optimizer_config.schema.json
44+
git commit -m "Update optimizer_config.schema.json"
45+
git push

.vscode/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22
"ruff.configuration": "pyproject.toml",
33
"python.analysis.extraPaths": [
44
"./docs/source"
5-
]
5+
],
6+
"yaml.schemas": {
7+
"./docs/optimizer_config.schema.json": [
8+
"*.yaml",
9+
"!*/.github/*/*.yaml"
10+
]
11+
}
612
}

0 commit comments

Comments
 (0)