-
Notifications
You must be signed in to change notification settings - Fork 21
125 lines (106 loc) · 4 KB
/
sdk-reference-sync.yml
File metadata and controls
125 lines (106 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Sync SDK Reference Documentation
on:
# manual trigger with inputs
workflow_dispatch:
inputs:
sdk:
description: "SDK to generate (js-sdk, python-sdk, cli, code-interpreter-js-sdk, code-interpreter-python-sdk, desktop-js-sdk, desktop-python-sdk, all)"
required: true
default: "all"
type: choice
options:
- all
- js-sdk
- python-sdk
- cli
- code-interpreter-js-sdk
- code-interpreter-python-sdk
- desktop-js-sdk
- desktop-python-sdk
version:
description: "Version to generate (all, latest, or specific like v2.9.0)"
required: true
default: "all"
type: string
# triggered from e2b-dev/e2b repo on release
repository_dispatch:
types: [sdk-release]
jobs:
generate:
runs-on: ubuntu-latest
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: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install root dependencies
run: pnpm install
- 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: Install Poetry
run: pip install poetry
- name: Determine SDK and Version
id: params
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
SDK="${{ github.event.inputs.sdk }}"
VERSION="${{ github.event.inputs.version }}"
elif [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
SDK="${{ github.event.client_payload.sdk }}"
# on repository_dispatch, default to "all" to auto-detect missing versions
VERSION="${{ github.event.client_payload.version }}"
VERSION="${VERSION:-all}"
fi
echo "sdk=${SDK:-all}" >> $GITHUB_OUTPUT
echo "version=${VERSION:-all}" >> $GITHUB_OUTPUT
- name: Generate SDK Reference
working-directory: sdk-reference-generator
run: |
pnpm run generate \
--sdk "${{ steps.params.outputs.sdk }}" \
--version "${{ steps.params.outputs.version }}"
- name: Verify generated files
run: |
echo "Generated SDK reference files:"
find docs/sdk-reference -type f -name "*.mdx" 2>/dev/null | head -20 || echo "No MDX files found"
- name: Commit and push changes
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"
else
git commit -m "[skip ci] Update SDK reference: ${{ steps.params.outputs.sdk }} ${{ steps.params.outputs.version }}"
git push
fi
- name: Summary
run: |
echo "## SDK Reference Generation Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **SDK**: ${{ steps.params.outputs.sdk }}" >> $GITHUB_STEP_SUMMARY
echo "- **Version**: ${{ steps.params.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Generated Files" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
find docs/sdk-reference -type f -name "*.mdx" | wc -l | xargs echo "Total MDX files:"
find docs/sdk-reference -type f -name "*.mdx" >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY