Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API documentation workflow #3281

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/update-api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 }}
Loading