Просмотр исходного кода

feature(docs): add GitHub Action to auto-generate wiki variable documentation

- Workflow triggers on main branch (for production use)
- Auto-generates markdown documentation for all module variables
- Updates wiki when module specs change
- Includes manual trigger option

Relates to #1316
xcad 2 месяцев назад
Родитель
Сommit
2fd5f85b49
1 измененных файлов с 77 добавлено и 0 удалено
  1. 77 0
      .github/workflows/docs-update-wiki-variables.yaml

+ 77 - 0
.github/workflows/docs-update-wiki-variables.yaml

@@ -0,0 +1,77 @@
+---
+name: Docs - Update Wiki Variables
+
+'on':
+  push:
+    branches:
+      - main
+    paths:
+      - 'cli/modules/*/spec_*.py'
+      - 'cli/modules/*/__init__.py'
+      - '.github/scripts/generate_wiki_docs.py'
+      - '.github/workflows/docs-update-wiki-variables.yaml'
+  workflow_dispatch:  # Allow manual trigger
+
+permissions:
+  contents: write
+
+jobs:
+  update-wiki:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v5
+        with:
+          fetch-depth: 1
+
+      - name: Checkout wiki repository
+        uses: actions/checkout@v5
+        with:
+          repository: ${{ github.repository }}.wiki
+          path: wiki
+          token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Set up Python
+        uses: actions/setup-python@v6
+        with:
+          python-version: '3.14'
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install typer rich pyyaml jinja2
+
+      - name: Generate variable documentation
+        run: |
+          python3 .github/scripts/generate_wiki_docs.py wiki/
+
+      - name: Check for changes
+        id: changes
+        working-directory: wiki
+        run: |
+          git add .
+          if git diff --staged --quiet; then
+            echo "has_changes=false" >> $GITHUB_OUTPUT
+            echo "No changes detected in wiki documentation"
+          else
+            echo "has_changes=true" >> $GITHUB_OUTPUT
+            echo "Changes detected in wiki documentation"
+          fi
+
+      - name: Commit and push changes
+        if: steps.changes.outputs.has_changes == 'true'
+        working-directory: wiki
+        run: |
+          git config user.name "github-actions[bot]"
+          git config user.email "github-actions[bot]@users.noreply.github.com"
+          git commit -m "Auto-update variable documentation from schema changes"
+          git push
+
+      - name: Summary
+        run: |
+          if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
+            echo "Wiki variable documentation updated successfully"
+            echo "View at: https://github.com/${{ github.repository }}/wiki"
+          else
+            echo "No changes to wiki documentation"
+          fi