Sync Connector Framework Docs #55
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: Sync Connector Framework Docs | |
| on: | |
| # Manual trigger | |
| workflow_dispatch: | |
| # Nightly sync | |
| schedule: | |
| - cron: "17 3 * * *" | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: docs-repo | |
| - name: Checkout connector repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: inorbit-ai/inorbit-connector-python | |
| ref: main | |
| path: connector-repo | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Build Mintlify-compatible docs | |
| run: | | |
| cd connector-repo/docs/mintlify | |
| make build | |
| - name: Sync to docs repo | |
| run: | | |
| # Remove old connector framework docs | |
| rm -rf docs-repo/ground-control/robot-integration/connector-framework | |
| # Copy built docs | |
| mkdir -p docs-repo/ground-control/robot-integration/connector-framework | |
| cp -r connector-repo/docs/mintlify/_build/* docs-repo/ground-control/robot-integration/connector-framework/ | |
| - name: Merge navigation into docs.json | |
| run: | | |
| cd docs-repo | |
| NAV_FILE="ground-control/robot-integration/connector-framework/navigation.json" | |
| DOCS_JSON="docs.json" | |
| if [ -f "$NAV_FILE" ]; then | |
| echo "Merging connector framework navigation into docs.json..." | |
| # Validate navigation.json is valid JSON | |
| if ! jq empty "$NAV_FILE" 2>/dev/null; then | |
| echo "Error: navigation.json is not valid JSON" | |
| exit 1 | |
| fi | |
| # Read the navigation object | |
| NAV_CONTENT=$(cat "$NAV_FILE") | |
| # Replace any existing connector framework entry with the new navigation. | |
| # This handles both: | |
| # - Simple string: "ground-control/robot-integration/connector-framework/index" | |
| # - Existing group object: {"group": "Connector Framework", ...} | |
| jq --argjson nav "$NAV_CONTENT" ' | |
| (.navigation.products[] | | |
| select(.product == "Ground Control") | | |
| .tabs[] | | |
| select(.tab == "Connecting Devices") | | |
| .pages) |= map( | |
| if (. == "ground-control/robot-integration/connector-framework/index") or | |
| (type == "object" and .group == "Connector Framework") | |
| then $nav | |
| else . | |
| end | |
| ) | |
| ' "$DOCS_JSON" > "${DOCS_JSON}.tmp" | |
| # Validate the resulting JSON is valid | |
| if ! jq empty "${DOCS_JSON}.tmp" 2>/dev/null; then | |
| echo "Error: Merge produced invalid JSON" | |
| exit 1 | |
| fi | |
| mv "${DOCS_JSON}.tmp" "$DOCS_JSON" | |
| echo "Navigation merged successfully" | |
| # Clean up navigation.json from the copied docs | |
| rm -f "$NAV_FILE" | |
| else | |
| echo "Warning: navigation.json not found, skipping merge" | |
| fi | |
| - name: Commit and push | |
| run: | | |
| cd docs-repo | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Sync connector framework docs from inorbit-connector-python" | |
| git push | |
| fi |