File tree 1 file changed +55
-0
lines changed 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : convert-examples-to-json
2
+
3
+ # author: @MikeRalphson / @cebe
4
+ # issue: https://github.com/OAI/OpenAPI-Specification/issues/1385
5
+
6
+ #
7
+ # This workflow updates the *.json files in the examples/v3.x directories,
8
+ # when the corresponding *.yaml files change.
9
+ # JSON example files are automatically generated from the YAML example files.
10
+ # Only the YAML files should be adjusted manually.
11
+ #
12
+
13
+ # run this on push to main
14
+ on :
15
+ push :
16
+ branches :
17
+ - main
18
+ paths :
19
+ - ' examples/**'
20
+
21
+ jobs :
22
+ yaml2json :
23
+
24
+ runs-on : ubuntu-latest
25
+
26
+ steps :
27
+ - uses : actions/checkout@v2 # checkout repo content
28
+
29
+ - uses : actions/setup-node@v4 # setup Node.js
30
+ with :
31
+ node-version : ' 20.x'
32
+
33
+ - name : Install dependencies
34
+ run : npm ci
35
+
36
+ - name : convert YAML examples to JSON
37
+ run : find examples/v3* -type f -name "*.yaml" | xargs node scripts/yaml2json/yaml2json.js
38
+
39
+ - name : git diff
40
+ run : |
41
+ git add examples/**/*.json
42
+ git --no-pager -c color.diff=always diff --staged
43
+
44
+ - name : Create Pull Request
45
+ uses : peter-evans/create-pull-request@v5
46
+ with :
47
+ token : ${{ secrets.GITHUB_TOKEN }}
48
+ branch : update-json-examples
49
+ title : Update JSON example files
50
+ commit-message : Update JSON example files
51
+ body : |
52
+ This pull request is automatically triggered by GitHub action `convert-examples-to-json`.
53
+
54
+ The examples/v3.* YAML files have changed, so the JSON files are automatically being recreated.
55
+
You can’t perform that action at this time.
0 commit comments