name: update docs source

on:
  push:
    branches:
      - main
    paths:
      - pkb_client/**

jobs:
  update:
    name: update docs source
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Set up Python 3.14
        uses: actions/setup-python@v6.2.0
        with:
          python-version: 3.14

      - name: Install sphinx
        run: pip install sphinx

      - name: Build docs source
        run: sphinx-apidoc -f -o docs/source pkb_client

      - name: Open PR with changes
        uses: peter-evans/create-pull-request@v8
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          title: "[Docs]: update docs source"
          commit-message: "update docs source"
          branch: "docs_source_update"
          delete-branch: true
          label: "docs-update"
          add-paths: docs/source
