fix: keep onboarding legible in dock #203
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: Docs Autopilot (push) | |
| on: | |
| push: | |
| branches: ["main", "development"] | |
| paths: | |
| - "server/**" | |
| - "web/**" | |
| - "scripts/docs_ai/**" | |
| - "scripts/generate_config_reference_docs.py" | |
| - "data/models.json" | |
| - "data/glossary.json" | |
| - "docker-compose.yml" | |
| - "pyproject.toml" | |
| - "start.sh" | |
| workflow_dispatch: | |
| inputs: | |
| base_ref: | |
| description: "Base ref to diff against (default: head of the last successful run on this branch; EMPTY bootstrap when there is none). Use EMPTY for a full bootstrap (empty-tree → HEAD)." | |
| required: false | |
| default: "" | |
| permissions: | |
| contents: write | |
| # Needed to dispatch `Publish MkDocs (mike)` after the autopilot pushes: | |
| # commits pushed with GITHUB_TOKEN never fire that workflow's own `push` trigger. | |
| actions: write | |
| concurrency: | |
| group: docs-autopilot-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docs-autopilot: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| env: | |
| # OpenRouter key used by scripts/docs_ai/generate_docs_from_diff.py | |
| # (Responses API). Add it with: gh secret set OPENROUTER_API_KEY | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| # z-ai/glm-5.3-flash: 1M-token window, 131k max completion, ~$0.08 a run, | |
| # which buys quoting the whole docs corpus so generated hunks apply. | |
| DOCS_AUTOPILOT_MODEL: ${{ vars.DOCS_AUTOPILOT_MODEL || 'z-ai/glm-5.3-flash' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Install project dependencies (uv) | |
| run: uv sync --frozen | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| pip install mkdocs==1.6.1 mkdocs-material==9.7.1 pymdown-extensions==10.7.1 | |
| pip install mike==2.1.0 mkdocs-git-revision-date-localized-plugin==1.2.6 mkdocs-minify-plugin==0.8.0 | |
| pip install mkdocs-glightbox | |
| - name: Run docs autopilot | |
| id: autopilot | |
| env: | |
| # run_ci_autopilot.py diffs from the head of the last successful run | |
| # on this branch (`gh run list`), never from the push's `before` SHA, | |
| # so a push whose run was cancelled by cancel-in-progress or failed | |
| # is still covered by the next run. No successful run on record means | |
| # the branch is undocumented: bootstrap on main, fork point elsewhere. | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| python scripts/docs_ai/run_ci_autopilot.py --base "${{ github.event.inputs.base_ref }}" | |
| - name: Check whether main's newest docs commit is published | |
| id: publish_state | |
| # Runs even when generation failed (missing key, LLM/build failure) so a | |
| # docs commit stranded by an earlier run still gets published. | |
| if: "!cancelled() && github.ref_name == 'main'" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| python scripts/docs_ai/run_ci_autopilot.py --publish-state | |
| - name: Publish with mike | |
| # A docs(ai) commit is pushed with GITHUB_TOKEN, which does not trigger | |
| # deploy-docs.yml's `push` event; workflow_dispatch is the documented | |
| # exception. Deciding from deploy history (not from this run's push) | |
| # also publishes commits stranded by an earlier cancelled/failed run. | |
| if: "!cancelled() && github.ref_name == 'main' && steps.publish_state.outputs.publish_needed == 'true'" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh workflow run deploy-docs.yml --ref main --repo "$GITHUB_REPOSITORY" | |
| - name: Upload docs autopilot artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mkdocs-docs-autopilot | |
| path: | | |
| mkdocs-docs-plan.md | |
| mkdocs-docs-llm.patch | |
| output/docs-autopilot/** | |
| if-no-files-found: ignore |