name: Update SDK Documentation # Regenerates SDK docs on PRs and commits them back to the branch, # so the PR is self-contained and main is correct after merge. on: pull_request: branches: ["main"] paths: - "src/**" - "pyproject.toml" workflow_dispatch: permissions: contents: write jobs: update-sdk-docs: timeout-minutes: 5 runs-on: ubuntu-latest if: >- github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository steps: - name: Generate Marvin App token id: marvin-token uses: actions/create-github-app-token@v2 with: app-id: ${{ secrets.MARVIN_APP_ID }} private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }} - uses: actions/checkout@v6 with: ref: ${{ github.head_ref || github.ref }} token: ${{ steps.marvin-token.outputs.token }} - name: Install uv uses: astral-sh/setup-uv@v7 with: enable-cache: true cache-dependency-glob: "uv.lock" - name: Install dependencies run: uv sync --python 3.12 - name: Install just uses: extractions/setup-just@v3 - name: Generate SDK documentation run: just api-ref-all - name: Commit and push if changed run: | git config user.name "marvin-context-protocol[bot]" git config user.email "225465937+marvin-context-protocol[bot]@users.noreply.github.com" git add docs/python-sdk/ if git diff --cached --quiet; then echo "SDK documentation is up to date" else git commit -m "chore: Update SDK documentation" git push echo "SDK documentation updated and pushed" fi