Update API Documentation #80
This file contains hidden or 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: Update API Documentation | |
| on: | |
| repository_dispatch: | |
| types: [ ocs_api_update ] | |
| schedule: | |
| - cron: '0 2 * * *' # Daily at 2 AM UTC | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Generate API documentation | |
| run: uv run python src/ocs_docs/openapi_to_docs.py https://raw.githubusercontent.com/dimagi/open-chat-studio/refs/heads/main/api-schema.yml -o docs/api/ | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if git diff --quiet docs/api/; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.check_changes.outputs.has_changes == 'true' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.OCS_DOCS_PAT }} | |
| commit-message: "update API documentation from OpenAPI schema" | |
| title: "Update API Documentation" | |
| body: | | |
| ## Summary | |
| - Automated update of API documentation from OpenAPI schema | |
| branch: update-api-docs-${{ github.run_number }} | |
| delete-branch: true | |
| assignees: snopoke | |
| team-reviewers: dimagi/open-chat-studio | |
| labels: automated |