-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.4 KB
/
generate-api-schema.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
name: Generate OpenAPI Schema for Redoc
on:
push:
branches:
- master
- dev
paths:
- "backend/**"
pull_request_target:
branches:
- master
- dev
paths:
- "backend/**"
jobs:
generate-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements/run-requirements.txt
# this edtion of the workflow uses Django's inbuilt generateschema to give us the schema file
- name: Generate the schema file
run: |
./backend/manage.py spectacular --file docs/schema.yml
- name: Commit the generated schema
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 🤖 commit the new OpenAPI schema
# this gives the commit author the github bot pfp and username
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
file_pattern: 'docs/schema.yml'