feat: automate MCP client documentation #8
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 Client Documentation | |
| on: | |
| pull_request: | |
| paths: | |
| - 'packages/mcp-server-supabase/src/clients.ts' | |
| - 'docs/clients/_template.md' | |
| - 'docs/scripts/**' | |
| jobs: | |
| generate-docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --ignore-scripts | |
| - name: Type check TypeScript files | |
| run: | | |
| echo "Type checking TypeScript files..." | |
| pnpm exec tsc --noEmit packages/mcp-server-supabase/src/clients.ts docs/scripts/generate-clients.ts | |
| pnpm exec tsc --noEmit docs/clients/constants.ts docs/scripts/generate-clients.ts | |
| - name: Generate client documentation | |
| run: npm run docs:generate-clients | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git diff --quiet README.md docs/clients/*.md || echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| if: steps.git-check.outputs.changed == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add README.md docs/clients/*.md | |
| git commit -m "docs: regenerate client documentation [skip ci]" | |
| git push | |
| - name: Comment on PR | |
| if: steps.git-check.outputs.changed == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '✅ Client documentation has been automatically regenerated and committed to this PR.' | |
| }) | |
| - name: Comment success (no changes) | |
| if: steps.git-check.outputs.changed != 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '✅ Client documentation validated. No changes needed.' | |
| }) |