-
-
Notifications
You must be signed in to change notification settings - Fork 338
42 lines (32 loc) · 1.2 KB
/
update-api-docs.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
name: Generate API documentation
on:
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Copy .env.example file to .env file
run: cp .env.example .env
- name: Set Git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Start Docker Compose
run: docker compose -f docker-compose.yml -f docker-compose.dev.yml up --detach dev-service
- name: Generate API documentation
run: docker exec -d mathesar_service_dev ./manage.py spectacular --color --file schema.yml
- name: Check if schema file has changed
id: check-schema-file
run: git diff --quiet schema.yml
- name: Commit schema file
if: steps.check-schema-file.outputs.status == 1
run: git add schema.yml && git commit -m "Updated schema file"
- name: Push changes to remote branch
if: steps.check-schema-file.outputs.status == 1
run: git push origin ${{ github.head_ref }}