-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (46 loc) · 1.65 KB
/
generate-jsonschemas.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Generate JSON Schemas
on:
workflow_dispatch:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-jsonschemas:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel poetry
- name: Install prettier
run: npm install --global prettier
- name: Build and Install DataYoga Core
run: |
cd core
poetry build
pip install dist/*.whl
- name: Generate DataYoga Job and Connections Schemas
run: |
python -c "import json; from datayoga_core.job import Job; schema = Job.get_json_schema(); open('schemas/job.schema.json', 'w').write(json.dumps(schema))"
python -c "import json; from datayoga_core.connection import Connection; schema = Connection.get_json_schema(); open('schemas/connections.schema.json', 'w').write(json.dumps(schema))"
- name: Prettify JSON Schema files
run: prettier --write "schemas/**/*.json"
- name: Push to repo
run: |
git config user.name github-actions
git config user.email [email protected]
git pull
git add .
if ! git diff --cached --exit-code; then
git commit -m "update json schemas"
git push
fi