docs-update-wiki.yaml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ---
  2. name: Docs - Update Wiki
  3. 'on':
  4. push:
  5. branches:
  6. - main
  7. paths:
  8. - 'cli/core/schema/**/*.json' # JSON schema files
  9. - '.wiki/**' # Static wiki pages
  10. - '.github/scripts/generate_wiki_docs.py' # Wiki generation script
  11. - '.github/workflows/docs-update-wiki.yaml' # This workflow
  12. workflow_dispatch: # Allow manual trigger
  13. permissions:
  14. contents: write
  15. jobs:
  16. update-wiki:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Checkout repository
  20. uses: actions/checkout@v5
  21. with:
  22. fetch-depth: 1
  23. - name: Checkout wiki repository
  24. uses: actions/checkout@v5
  25. with:
  26. repository: ${{ github.repository }}.wiki
  27. path: wiki
  28. token: ${{ secrets.GITHUB_TOKEN }}
  29. - name: Set up Python
  30. uses: actions/setup-python@v6
  31. with:
  32. python-version: '3.14'
  33. - name: Install dependencies
  34. run: |
  35. python -m pip install --upgrade pip
  36. pip install -e .
  37. - name: Generate variable documentation
  38. run: |
  39. python3 .github/scripts/generate_wiki_docs.py wiki/
  40. - name: Sync wiki pages from .wiki directory
  41. run: |
  42. # Copy all markdown files from .wiki/ to wiki/ (except Variables-*.md which are auto-generated)
  43. if [ -d ".wiki" ]; then
  44. echo "Syncing wiki pages from .wiki/ directory..."
  45. for file in .wiki/*.md; do
  46. filename=$(basename "$file")
  47. # Skip auto-generated variable documentation files
  48. if [[ ! "$filename" =~ ^Variables- ]]; then
  49. echo " Copying $filename"
  50. cp "$file" "wiki/$filename"
  51. fi
  52. done
  53. else
  54. echo "No .wiki directory found, skipping static wiki pages sync"
  55. fi
  56. - name: Check for changes
  57. id: changes
  58. working-directory: wiki
  59. run: |
  60. git add .
  61. if git diff --staged --quiet; then
  62. echo "has_changes=false" >> $GITHUB_OUTPUT
  63. echo "No changes detected in wiki documentation"
  64. else
  65. echo "has_changes=true" >> $GITHUB_OUTPUT
  66. echo "Changes detected in wiki documentation"
  67. fi
  68. - name: Commit and push changes
  69. if: steps.changes.outputs.has_changes == 'true'
  70. working-directory: wiki
  71. run: |
  72. git config user.name "github-actions[bot]"
  73. git config user.email "github-actions[bot]@users.noreply.github.com"
  74. git commit -m "Auto-update wiki pages"
  75. # Pull with rebase to handle any remote changes, then push
  76. # GitHub wikis use master as default branch
  77. git pull --rebase origin master
  78. git push origin master
  79. - name: Summary
  80. run: |
  81. if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
  82. echo "Wiki variable documentation updated successfully"
  83. echo "View at: https://github.com/${{ github.repository }}/wiki"
  84. else
  85. echo "No changes to wiki documentation"
  86. fi