Generate toolkit docs #64
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 toolkit docs | |
| # Description: Generate toolkit JSON from Engine API, then sync sidebar navigation. | |
| # Flow: | |
| # 1) Build the toolkit docs generator | |
| # 2) Generate toolkit JSON into toolkit-docs-generator/data/toolkits | |
| # 3) Sync integrations sidebar _meta.tsx from toolkit-docs-generator/data/toolkits | |
| # 4) Open a PR if changes were produced | |
| on: | |
| repository_dispatch: | |
| types: [porter_deploy_succeeded] | |
| workflow_dispatch: | |
| # 11:00 UTC = 3 AM PST / 4 AM PDT — late enough that DST drift doesn't matter. | |
| schedule: | |
| - cron: "0 11 * * *" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build toolkit docs generator | |
| run: pnpm build | |
| working-directory: toolkit-docs-generator | |
| - name: Generate toolkit docs | |
| run: | | |
| pnpm dlx tsx src/cli/index.ts generate \ | |
| --all \ | |
| --skip-unchanged \ | |
| --require-complete \ | |
| --verbose \ | |
| --api-source tool-metadata \ | |
| --tool-metadata-url "$ENGINE_API_URL" \ | |
| --tool-metadata-key "$ENGINE_API_KEY" \ | |
| --llm-provider openai \ | |
| --llm-model "$OPENAI_MODEL" \ | |
| --llm-api-key "$OPENAI_API_KEY" \ | |
| --toolkit-concurrency 8 \ | |
| --llm-concurrency 15 \ | |
| --exclude-file ./excluded-toolkits.txt \ | |
| --ignore-file ./ignored-toolkits.txt \ | |
| --output data/toolkits | |
| working-directory: toolkit-docs-generator | |
| env: | |
| ENGINE_API_URL: ${{ secrets.ENGINE_API_URL }} | |
| ENGINE_API_KEY: ${{ secrets.ENGINE_API_KEY }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| OPENAI_MODEL: ${{ secrets.OPENAI_MODEL || 'gpt-4o-mini' }} | |
| - name: Sync toolkit sidebar navigation | |
| run: pnpm dlx tsx toolkit-docs-generator/scripts/sync-toolkit-sidebar.ts --remove-empty-sections=false --verbose | |
| - name: Check for changes | |
| id: check-changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create pull request | |
| if: steps.check-changes.outputs.has_changes == 'true' | |
| id: cpr | |
| uses: peter-evans/create-pull-request@v7 | |
| env: | |
| HUSKY: 0 | |
| with: | |
| token: ${{ secrets.DOCS_PUBLISHABLE_GH_TOKEN }} | |
| commit-message: "[AUTO] Adding MCP Servers docs update" | |
| title: "[AUTO] Adding MCP Servers docs update" | |
| body: | | |
| This PR was generated after a Porter deploy succeeded. | |
| - Trigger: ${{ github.event_name }} | |
| - Deploy env: ${{ github.event.client_payload.env || 'unknown' }} | |
| - Deploy SHA: ${{ github.event.client_payload.deploy_sha || 'unknown' }} | |
| - Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| branch: automation/toolkit-docs-${{ github.run_id }} | |
| delete-branch: true | |
| - name: Request team review | |
| if: steps.check-changes.outputs.has_changes == 'true' && steps.cpr.outputs.pull-request-number != '' | |
| continue-on-error: true | |
| run: gh pr edit ${{ steps.cpr.outputs.pull-request-number }} --add-reviewer ArcadeAI/engineering-tools-and-dx | |
| env: | |
| GH_TOKEN: ${{ secrets.DOCS_PUBLISHABLE_GH_TOKEN }} |