ci: make docs generation non-blocking when API credits are low #38
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: Generate Docs | |
| on: | |
| push: | |
| branches: [master] | |
| concurrency: | |
| group: docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| generate-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: pip install anthropic | |
| - name: Generate all wiki pages | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| continue-on-error: true | |
| run: python scripts/generate_docs.py | |
| - name: Push to wiki | |
| env: | |
| WIKI_PAT: ${{ secrets.WIKI_PAT }} | |
| run: | | |
| # Clone wiki repo | |
| git clone https://x-access-token:${WIKI_PAT}@github.com/HanSur94/matlab-mcp-server-python.wiki.git /tmp/wiki | |
| # Copy all generated wiki pages | |
| cp wiki/*.md /tmp/wiki/ | |
| # Check for changes (status --porcelain catches new/untracked files too) | |
| cd /tmp/wiki | |
| [ -z "$(git status --porcelain)" ] && echo "No changes to wiki" && exit 0 | |
| # Commit and push | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add *.md | |
| git commit -m "docs: auto-update wiki" | |
| git push |