-
Notifications
You must be signed in to change notification settings - Fork 102
54 lines (46 loc) · 1.52 KB
/
update-docs.yaml
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
name: Regenerate Endpoints docs on change
on:
push:
paths:
- 'schemas/openapi.yml'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs/
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: '16.x'
- run: npm i
- run: npm run generateEndpoints
- name: Commit changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git commit -am "Update endpoint docs" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install swagger-cli
run: |
npm install -g swagger-cli
npm install -g openapi-format
- name: Lint and Convert openapi.yml to openapi.json and commit changes
run: |
cd ..
npx openapi-format schemas/openapi.yml --output schemas/openapi.yml
swagger-cli bundle -r schemas/openapi.yml -o schemas/openapi.json -t json
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add schemas/openapi.yml
git add schemas/openapi.json
git commit -am "Lint OpenAPI schemas" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}