Add API documentation workflow #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate API documentation | |
on: | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Git identity | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- 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: Build Docker image | |
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 | |
run: git diff --quiet schema.yml || exit 0 | |
- name: Commit schema file | |
run: git add schema.yml && git commit -m "Updated schema file" | |
- name: Push changes to remote branch | |
run: git push origin ${{ github.head_ref }} |