-
Notifications
You must be signed in to change notification settings - Fork 7
Feature: SDK Reference generation & hosting #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ben-fornefeld
wants to merge
39
commits into
main
Choose a base branch
from
feature-sdk-reference-generation-inside-e2b-devdocs-eng-3413
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
1d46a34
wip: sdk reference generation workflow
ben-fornefeld 254049f
Refactor SDK reference generation workflow
ben-fornefeld f75a36f
Enhance SDK navigation and styling
ben-fornefeld 1927687
cleanup
ben-fornefeld 81afe32
fix: sdks.json
ben-fornefeld e97acb3
Enhance SDK reference generation and configuration
ben-fornefeld a191e97
improve: better idempotency comparison
ben-fornefeld ddcf32a
cleanup
ben-fornefeld 3890aa2
refactor: bash to typescript generator
ben-fornefeld c0ecf0b
cleanup:
ben-fornefeld cb7be7f
refactor: migrate SDK configuration from JSON to TypeScript
ben-fornefeld 24b4430
refactor: improve SDK reference generation and navigation
ben-fornefeld 87e0c1d
chore: remove package.json and pnpm-lock.yaml
ben-fornefeld 89d8116
fix: config
ben-fornefeld c9f0fd6
refactor: update SDK configuration and improve generation logic
ben-fornefeld 9ce811f
chore
ben-fornefeld a0aa2e4
cleanup
ben-fornefeld 38682df
refactor: improve error handling and logging in CLI and generator
ben-fornefeld 42c4f4f
add: last 3 versions of all sdks to docs
ben-fornefeld 9b940a6
reactive TOC
ben-fornefeld 1dfbd1b
refactor: enhance SDK reference generation workflow
ben-fornefeld 6bfbc7d
fix: pip install fallback
ben-fornefeld 804758a
fix: update SDK documentation for clarity and accuracy
ben-fornefeld 13ef59c
remove: generated sdk reference
ben-fornefeld 07d46d4
add: limit as input
ben-fornefeld 4d0ce3f
fix: infer limit input correctly in workflow
ben-fornefeld 3a1d58f
fix: limit
ben-fornefeld a7a75f8
fix limit
ben-fornefeld 09a27fa
chore: force color
ben-fornefeld 15ff8e3
cleanup: action
ben-fornefeld ca5cedb
refactor: replace process.exit with error throwing for better error h…
ben-fornefeld 5748e31
add: tests
ben-fornefeld 9eb05fc
feat: enhance SDK configuration with version-specific overrides and a…
ben-fornefeld 1df3c3a
fix: versioning config
ben-fornefeld b46a603
fix: silent fs move issues
ben-fornefeld cfaa83a
fix: pip installs
ben-fornefeld a3dd778
cleanup files before force regeneration
ben-fornefeld 9670c39
fix: normailze versioning
ben-fornefeld 4eaca6f
improve: pr test workflow + chore: cleanup docs.json
ben-fornefeld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Test SDK Reference Generator | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "sdk-reference-generator/**" | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9 | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: sdk-reference-generator | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Run tests | ||
| working-directory: sdk-reference-generator | ||
| run: pnpm test | ||
|
|
||
| - name: TypeScript check | ||
| working-directory: sdk-reference-generator | ||
| run: npx tsc --noEmit | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| name: Sync SDK Reference Documentation | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| sdk: | ||
| description: "SDK to generate (see sdks.config.ts for available SDKs, or use 'all')" | ||
| required: true | ||
| default: "all" | ||
| type: string | ||
| version: | ||
| description: "Version to generate (all, latest, or specific like v2.9.0)" | ||
| required: true | ||
| default: "latest" | ||
| type: string | ||
| limit: | ||
| description: "Limit number of versions to generate (default: 5)" | ||
| required: false | ||
| default: 5 | ||
| type: number | ||
| force: | ||
| description: "Force regeneration of existing versions" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| repository_dispatch: | ||
| types: [sdk-release] | ||
|
|
||
| # prevent concurrent runs that could conflict | ||
| concurrency: | ||
| group: sdk-reference-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| generate: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout docs repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9 | ||
|
|
||
| - name: Cache pnpm dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.pnpm-store | ||
| sdk-reference-generator/node_modules | ||
| key: ${{ runner.os }}-pnpm-${{ hashFiles('sdk-reference-generator/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm- | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
|
|
||
| - name: Install generator dependencies | ||
| working-directory: sdk-reference-generator | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Install Python dependencies | ||
| run: pip install -r requirements.txt | ||
|
|
||
| - name: Determine SDK and Version | ||
| id: params | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| INPUT_SDK: ${{ github.event.inputs.sdk }} | ||
| INPUT_VERSION: ${{ github.event.inputs.version }} | ||
| INPUT_LIMIT: ${{ github.event.inputs.limit }} | ||
| INPUT_FORCE: ${{ github.event.inputs.force }} | ||
| PAYLOAD_SDK: ${{ github.event.client_payload.sdk }} | ||
| PAYLOAD_VERSION: ${{ github.event.client_payload.version }} | ||
| PAYLOAD_LIMIT: ${{ github.event.client_payload.limit }} | ||
| run: | | ||
| if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then | ||
| SDK="$INPUT_SDK" | ||
| VERSION="$INPUT_VERSION" | ||
| LIMIT="$INPUT_LIMIT" | ||
| FORCE="$INPUT_FORCE" | ||
| elif [[ "$EVENT_NAME" == "repository_dispatch" ]]; then | ||
| SDK="$PAYLOAD_SDK" | ||
| VERSION="${PAYLOAD_VERSION:-latest}" | ||
| LIMIT="${PAYLOAD_LIMIT:-5}" | ||
| FORCE="false" | ||
| fi | ||
|
|
||
| echo "sdk=${SDK:-all}" >> $GITHUB_OUTPUT | ||
| echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT | ||
| echo "limit=${LIMIT:-5}" >> $GITHUB_OUTPUT | ||
| echo "force=${FORCE:-false}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Generate SDK Reference | ||
| working-directory: sdk-reference-generator | ||
| env: | ||
| SDK_NAME: ${{ steps.params.outputs.sdk }} | ||
| SDK_VERSION: ${{ steps.params.outputs.version }} | ||
| LIMIT: ${{ steps.params.outputs.limit }} | ||
| FORCE: ${{ steps.params.outputs.force }} | ||
| FORCE_COLOR: "2" | ||
| run: | | ||
| ARGS="--sdk $SDK_NAME --version $SDK_VERSION" | ||
|
|
||
| if [[ -n "$LIMIT" && "$LIMIT" != "0" ]]; then | ||
| ARGS="$ARGS --limit $LIMIT" | ||
| fi | ||
|
|
||
| if [[ "$FORCE" == "true" ]]; then | ||
| ARGS="$ARGS --force" | ||
| fi | ||
|
|
||
| pnpm run generate $ARGS | ||
|
|
||
| - name: Commit and push changes | ||
| id: commit | ||
| env: | ||
| SDK_NAME: ${{ steps.params.outputs.sdk }} | ||
| SDK_VERSION: ${{ steps.params.outputs.version }} | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| git add docs/sdk-reference/ | ||
| git add docs.json | ||
|
|
||
| if git diff --staged --quiet; then | ||
| echo "No changes to commit" | ||
| echo "changes=false" >> $GITHUB_OUTPUT | ||
| else | ||
| git commit -m "docs: update SDK reference for $SDK_NAME $SDK_VERSION" | ||
| git push | ||
| echo "changes=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Summary | ||
| env: | ||
| SDK_NAME: ${{ steps.params.outputs.sdk }} | ||
| SDK_VERSION: ${{ steps.params.outputs.version }} | ||
| LIMIT: ${{ steps.params.outputs.limit }} | ||
| CHANGES: ${{ steps.commit.outputs.changes }} | ||
| run: | | ||
| echo "## SDK Reference Generation Complete" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Parameter | Value |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|-----------|-------|" >> $GITHUB_STEP_SUMMARY | ||
| echo "| SDK | $SDK_NAME |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Version | $SDK_VERSION |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Limit | ${LIMIT:-No limit} |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Changes committed | $CHANGES |" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| if [[ "$CHANGES" == "true" ]]; then | ||
| echo "### Generated Files" >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| echo "Total MDX files: $(find docs/sdk-reference -type f -name '*.mdx' | wc -l)" >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| fi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| .idea | ||
| .DS_Store | ||
|
|
||
| node_modules | ||
|
|
||
| # Generated SDK navigation (intermediate file) | ||
| sdk_navigation.json |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| sdk-reference-generator/ | ||
|
|
||
| scripts/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be probably changed. I would make it either manually callable, or run on every PR?