From b5ada521f8c1b98b657bbf470e0abd1db2c31846 Mon Sep 17 00:00:00 2001 From: dslovinsky Date: Fri, 23 Jan 2026 18:27:34 -0500 Subject: [PATCH] feat: call revalidate index endpoint after content-indexer --- .github/workflows/index-changelog.yml | 37 ++++++++++++++++++ .github/workflows/index-main-content.yml | 45 ++++++++++++++++++++++ .github/workflows/index-sdk-references.yml | 39 +++++++++++++++++++ 3 files changed, 121 insertions(+) diff --git a/.github/workflows/index-changelog.yml b/.github/workflows/index-changelog.yml index e6988ef4d..e81eade45 100644 --- a/.github/workflows/index-changelog.yml +++ b/.github/workflows/index-changelog.yml @@ -27,3 +27,40 @@ jobs: 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 }} + + - name: Revalidate changelog index cache + run: | + echo "Revalidating changelog index cache..." + + # Create JSON payload + PAYLOAD='{"pathIndices": ["changelog"]}' + + # 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 changelog index" + fi diff --git a/.github/workflows/index-main-content.yml b/.github/workflows/index-main-content.yml index 3da3fb772..325504789 100644 --- a/.github/workflows/index-main-content.yml +++ b/.github/workflows/index-main-content.yml @@ -28,3 +28,48 @@ jobs: 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 diff --git a/.github/workflows/index-sdk-references.yml b/.github/workflows/index-sdk-references.yml index 8b1cc7050..a15c4fb5e 100644 --- a/.github/workflows/index-sdk-references.yml +++ b/.github/workflows/index-sdk-references.yml @@ -34,3 +34,42 @@ jobs: 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 }} + + - name: Revalidate SDK index and wallets nav cache + run: | + echo "Revalidating SDK index and wallets nav cache..." + + # SDK indexer only updates the wallets nav tree (hardcoded in indexer) + PAYLOAD='{"pathIndices": ["sdk"], "navTrees": ["wallets"]}' + + 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 SDK index and wallets nav" + fi