-
Notifications
You must be signed in to change notification settings - Fork 7
38 lines (34 loc) · 1.2 KB
/
update_openapi_json.yml
File metadata and controls
38 lines (34 loc) · 1.2 KB
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
name: Update OpenAPI JSON files from YAML sources
on:
pull_request:
branches: ["main"]
paths:
- "api-reference/openapi.yaml"
- "api-reference/voice/voice.asyncapi.yaml"
jobs:
convert_yaml_to_json:
name: Convert YAML specs to JSON
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}
- name: Convert YAML specs to JSON
run: |
python3 -c "
import yaml, json, sys
for src, dst in [
('api-reference/openapi.yaml', 'api-reference/openapi.json'),
('api-reference/voice/voice.asyncapi.yaml', 'api-reference/voice/voice.asyncapi.json'),
]:
with open(src) as f:
data = yaml.safe_load(f)
with open(dst, 'w') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
f.write('\n')
"
- name: Commit updated JSON files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update OpenAPI JSON files from YAML sources"
file_pattern: "api-reference/openapi.json api-reference/voice/voice.asyncapi.json"