From 3daa6e7143ddab4383760ea614d2d1df041b3a88 Mon Sep 17 00:00:00 2001 From: Varsha-dr <114489823+varshadr@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:22:11 +0530 Subject: [PATCH] Implemented workflow to automate api documentation --- .github/workflows/update-api-docs.yml | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/update-api-docs.yml diff --git a/.github/workflows/update-api-docs.yml b/.github/workflows/update-api-docs.yml new file mode 100644 index 0000000000..49b24284f2 --- /dev/null +++ b/.github/workflows/update-api-docs.yml @@ -0,0 +1,32 @@ +name: Generate API documentation + +on: + push_request: + branches: + - develop + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Docker image + run: docker compose -f docker-compose.yml -f docker-compose.dev.yml up dev-service + + - name: Generate API documentation + uses: addnab/docker-run-action@v3 + with: + image: mathesar/mathesar-dev:latest + run: ./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 "Add schema file" + + - name: Push changes to remote branch + run: git push origin ${{ github.head_ref }}