feat: add Admin API docs with remote OpenAPI spec (#996) #13
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: Index Main Content | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "fern/docs.yml" | |
| workflow_dispatch: {} | |
| jobs: | |
| index-main: | |
| name: Index Main Content | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: ./.github/actions/setup-pnpm | |
| - name: Run main content indexer | |
| run: pnpm index:main | |
| env: | |
| KV_REST_API_TOKEN: ${{ secrets.KV_REST_API_TOKEN }} | |
| KV_REST_API_URL: ${{ secrets.KV_REST_API_URL }} | |
| ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
| ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }} | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Revalidate docs index and nav caches | |
| run: | | |
| echo "Revalidating docs index and navigation caches..." | |
| # Extract tab IDs from docs.yml (these are the nav tree keys) | |
| NAV_TREES=$(yq -o=json '.tabs | keys' fern/docs.yml) | |
| echo "Nav trees to revalidate: $NAV_TREES" | |
| # Create JSON payload using jq | |
| PAYLOAD=$(jq -n \ | |
| --argjson navTrees "$NAV_TREES" \ | |
| '{pathIndices: ["docs"], navTrees: $navTrees}') | |
| echo "Payload: $PAYLOAD" | |
| # Call revalidation API | |
| HTTP_CODE=$(curl -X POST "${{ secrets.DOCS_SITE_URL }}/api/revalidate/indices" \ | |
| -H "Authorization: Bearer ${{ secrets.DOCS_SITE_API_KEY }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" \ | |
| --max-time 30 \ | |
| --fail-with-body \ | |
| -o response.json \ | |
| -w "%{http_code}" \ | |
| -s) | |
| echo "" | |
| echo "Response (HTTP $HTTP_CODE):" | |
| jq '.' response.json || cat response.json | |
| # Check HTTP status | |
| if [ "$HTTP_CODE" != "200" ]; then | |
| echo "::error::Indices revalidation API returned status $HTTP_CODE" | |
| exit 1 | |
| fi | |
| # Check success field in response | |
| SUCCESS=$(jq -r '.success' response.json) | |
| if [ "$SUCCESS" != "true" ]; then | |
| echo "::warning::Revalidation completed with errors" | |
| jq -r '.errors[]?' response.json | |
| else | |
| echo "::notice::✅ Successfully revalidated docs index and nav trees" | |
| fi |