Skip to content

index-sdk-references #3

index-sdk-references

index-sdk-references #3

name: Index SDK References
on:
repository_dispatch:
types:
- index-sdk-references
jobs:
index-sdk:
name: Index SDK References
runs-on: ubuntu-latest
# Only run if the dispatch came from the aa-sdk repository
if: github.event.client_payload.source == 'alchemyplatform/aa-sdk'
permissions:
contents: read
steps:
- name: Checkout docs repository
uses: actions/checkout@v4
- name: Sparse checkout aa-sdk docs
uses: actions/checkout@v4
with:
repository: alchemyplatform/aa-sdk
sparse-checkout: docs
path: aa-sdk-docs
- name: Setup pnpm
uses: ./.github/actions/setup-pnpm
- name: Run SDK indexer
run: pnpm index:sdk
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 }}
- 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