157 lines
6.3 KiB
YAML
157 lines
6.3 KiB
YAML
name: Docs - Update Data
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 */5 * * *'
|
|
repository_dispatch:
|
|
types: [apollo-production-deploy]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
update-data:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./docs
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
env:
|
|
COMPOSIO_API_KEY: ${{ secrets.COMPOSIO_API_KEY }}
|
|
|
|
steps:
|
|
- name: Generate GitHub App token
|
|
id: app-token
|
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
with:
|
|
client-id: ${{ vars.RELEASE_BOT_CLIENT_ID }}
|
|
private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
|
|
- name: Log trigger source
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
HERMES_COMMIT: ${{ github.event.client_payload.hermes_commit }}
|
|
DEPLOY_TIMESTAMP: ${{ github.event.client_payload.timestamp }}
|
|
run: |
|
|
echo "Workflow triggered by: $EVENT_NAME"
|
|
if [ "$EVENT_NAME" = "repository_dispatch" ]; then
|
|
echo "Triggered by Apollo production deployment"
|
|
echo "Hermes commit: $HERMES_COMMIT"
|
|
echo "Timestamp: $DEPLOY_TIMESTAMP"
|
|
fi
|
|
|
|
- name: Setup Node.js, pnpm, Bun
|
|
uses: ./.github/actions/setup-node-pnpm-bun
|
|
|
|
- name: Configure staging API endpoints
|
|
env:
|
|
COMPOSIO_BASE_URL_STAGING: ${{ secrets.COMPOSIO_BASE_URL_STAGING }}
|
|
run: |
|
|
staging_base="${COMPOSIO_BASE_URL_STAGING%/}"
|
|
|
|
if [ -z "$staging_base" ]; then
|
|
echo "::error::COMPOSIO_BASE_URL_STAGING is not set"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$staging_base" == "https://backend.composio.dev" || "$staging_base" == "https://backend.composio.dev/"* ]]; then
|
|
echo "::error::COMPOSIO_BASE_URL_STAGING points at production"
|
|
exit 1
|
|
fi
|
|
|
|
staging_origin="${staging_base%/api/v3.1}"
|
|
staging_origin="${staging_origin%/api/v3}"
|
|
staging_v3_base="$staging_origin/api/v3"
|
|
staging_v31_base="$staging_origin/api/v3.1"
|
|
|
|
{
|
|
echo "COMPOSIO_API_BASE=$staging_v3_base"
|
|
echo "OPENAPI_SPEC_URL=$staging_v3_base/openapi.json"
|
|
echo "OPENAPI_V31_SPEC_URL=$staging_v31_base/openapi.json"
|
|
} >> "$GITHUB_ENV"
|
|
|
|
echo "Configured staging API endpoints"
|
|
|
|
- name: Cache bun dependencies
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('docs/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Generate toolkits data
|
|
run: bun run generate:toolkits
|
|
|
|
- name: Fetch OpenAPI spec
|
|
run: bun run scripts/fetch-openapi.mjs
|
|
|
|
- name: Generate API index pages
|
|
run: bun run generate:api-index
|
|
|
|
- name: Generate meta tools reference
|
|
run: bun run generate:meta-tools
|
|
|
|
- name: Check for changes
|
|
id: changes
|
|
run: |
|
|
cd ..
|
|
git add -N docs/public/data/ docs/public/openapi.json docs/public/openapi-v3.json docs/content/reference/api-reference/ docs/content/reference/v3/api-reference/ docs/content/toolkits/meta-tools/ 2>/dev/null || true
|
|
if git diff --quiet docs/public/data/ docs/public/openapi.json docs/public/openapi-v3.json docs/content/reference/api-reference/ docs/content/reference/v3/api-reference/ docs/content/toolkits/meta-tools/ 2>/dev/null; then
|
|
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
|
echo "No changes detected"
|
|
else
|
|
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
|
echo "Changes detected:"
|
|
git diff --stat docs/public/data/ docs/public/openapi.json docs/public/openapi-v3.json docs/content/reference/api-reference/ docs/content/reference/v3/api-reference/ docs/content/toolkits/meta-tools/ 2>/dev/null || true
|
|
fi
|
|
|
|
- name: Create Pull Request
|
|
id: create-pr
|
|
if: steps.changes.outputs.has_changes == 'true'
|
|
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
commit-message: 'docs: update toolkits and API data'
|
|
title: 'docs: update toolkits, API spec, and meta tools data'
|
|
body: |
|
|
## Summary
|
|
Automated sync of backend data into the docs site. Triggered by: `${{ github.event_name }}`${{ github.event_name == 'repository_dispatch' && format(' (Hermes commit: {0})', github.event.client_payload.hermes_commit) || '' }}.
|
|
|
|
## What changed
|
|
- **Toolkit catalog** (`docs/public/data/toolkits.json`, `toolkits-list.json`) — refreshed list of available toolkits, auth schemes, and tools from the backend API
|
|
- **OpenAPI specs** (`docs/public/openapi.json`, `docs/public/openapi-v3.json`) — latest v3.1 and v3.0 API specifications fetched from staging
|
|
- **API reference pages** (`docs/content/reference/api-reference/`, `docs/content/reference/v3/api-reference/`) — regenerated index pages for both API versions
|
|
- **Meta tools reference** (`docs/public/data/meta-tools.json`, `docs/content/toolkits/meta-tools/*.mdx`) — updated meta tool schemas and reference docs
|
|
branch: docs/auto-update-data
|
|
base: next
|
|
add-paths: |
|
|
docs/public/data/
|
|
docs/public/openapi.json
|
|
docs/public/openapi-v3.json
|
|
docs/content/reference/api-reference/
|
|
docs/content/reference/v3/api-reference/
|
|
docs/content/toolkits/meta-tools/
|
|
|
|
- name: Request review from trigger actor
|
|
if: steps.create-pr.outputs.pull-request-number
|
|
continue-on-error: true
|
|
env:
|
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
|
|
AUTHOR: ${{ github.actor }}
|
|
run: |
|
|
gh pr edit "$PR_NUMBER" --add-reviewer "$AUTHOR" || \
|
|
gh pr edit "$PR_NUMBER" --add-reviewer "Sushmithamallesh"
|