8181 - name : Install Python dependencies
8282 run : pip install -r requirements.txt
8383
84- - name : Determine sync parameters
84+ - name : Resolve generation inputs from trigger
8585 id : params
8686 env :
8787 EVENT_NAME : ${{ github.event_name }}
9292 PAYLOAD_SDK : ${{ github.event.client_payload.sdk }}
9393 PAYLOAD_VERSION : ${{ github.event.client_payload.version }}
9494 PAYLOAD_LIMIT : ${{ github.event.client_payload.limit }}
95- run : |
96- if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
97- TRIGGER="workflow_dispatch"
98- SDK="$INPUT_SDK"
99- VERSION="$INPUT_VERSION"
100- LIMIT="$INPUT_LIMIT"
101- FORCE="$INPUT_FORCE"
102- elif [[ "$EVENT_NAME" == "repository_dispatch" ]]; then
103- TRIGGER="repository_dispatch (sdk-release)"
104- SDK="$PAYLOAD_SDK"
105- VERSION="${PAYLOAD_VERSION:-latest}"
106- LIMIT="${PAYLOAD_LIMIT:-5}"
107- FORCE="false"
108- elif [[ "$EVENT_NAME" == "schedule" ]]; then
109- TRIGGER="schedule (*/15 * * * *)"
110- SDK="all"
111- VERSION="all"
112- LIMIT="3"
113- FORCE="false"
114- else
115- TRIGGER="$EVENT_NAME"
116- SDK="all"
117- VERSION="latest"
118- LIMIT="5"
119- FORCE="false"
120- fi
121-
122- if [[ -z "$LIMIT" || "$LIMIT" == "0" ]]; then
123- LIMIT_DISPLAY="No limit"
124- else
125- LIMIT_DISPLAY="$LIMIT"
126- fi
127-
128- echo "trigger=$TRIGGER" >> $GITHUB_OUTPUT
129- echo "sdk=${SDK:-all}" >> $GITHUB_OUTPUT
130- echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT
131- echo "limit=${LIMIT:-5}" >> $GITHUB_OUTPUT
132- echo "limit_display=$LIMIT_DISPLAY" >> $GITHUB_OUTPUT
133- echo "force=${FORCE:-false}" >> $GITHUB_OUTPUT
95+ run : bash scripts/resolve-sdk-reference-sync-params.sh
13496
13597 - name : Generate SDK Reference
13698 working-directory : sdk-reference-generator
@@ -168,40 +130,24 @@ jobs:
168130 echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
169131 echo "total_mdx_files=$TOTAL_MDX_FILES" >> $GITHUB_OUTPUT
170132
171- - name : Create pull request
133+ - name : Commit changes and manage pull request
172134 if : steps.changes.outputs.changes == 'true'
173- id : cpr
174- uses : peter-evans/create-pull-request@v8
175- with :
176- branch : automation/sdk-reference-sync
177- delete-branch : true
178- add-paths : |
179- docs/sdk-reference
180- docs.json
181- author : github-actions[bot] <github-actions[bot]@users.noreply.github.com>
182- committer : github-actions[bot] <github-actions[bot]@users.noreply.github.com>
183- commit-message : docs: sync SDK reference for ${{ steps.params.outputs.sdk }} ${{ steps.params.outputs.version }}
184- title : docs: sync SDK reference for ${{ steps.params.outputs.sdk }} ${{ steps.params.outputs.version }}
185- body : |
186- ## Summary
187- This automated PR syncs generated SDK reference documentation.
188-
189- ## Trigger
190- - Source: `${{ steps.params.outputs.trigger }}`
191- - SDK: `${{ steps.params.outputs.sdk }}`
192- - Version: `${{ steps.params.outputs.version }}`
193- - Limit: `${{ steps.params.outputs.limit_display }}`
194- - Force: `${{ steps.params.outputs.force }}`
195-
196- ## Changes
197- - Updates generated reference files under `docs/sdk-reference/**`
198- - Updates `docs.json` navigation when generation changes the docs tree
199- - Changed files detected in this run: `${{ steps.changes.outputs.changed_files }}`
200- - Total tracked MDX reference files after generation: `${{ steps.changes.outputs.total_mdx_files }}`
201-
202- ## Run Details
203- - Workflow: `${{ github.workflow }}`
204- - Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
135+ id : pr
136+ env :
137+ GH_TOKEN : ${{ github.token }}
138+ BASE_BRANCH : ${{ github.ref_name }}
139+ BRANCH_NAME : automation/sdk-reference-sync
140+ TRIGGER : ${{ steps.params.outputs.trigger }}
141+ SDK_NAME : ${{ steps.params.outputs.sdk }}
142+ SDK_VERSION : ${{ steps.params.outputs.version }}
143+ LIMIT_DISPLAY : ${{ steps.params.outputs.limit_display }}
144+ FORCE : ${{ steps.params.outputs.force }}
145+ CHANGED_FILES : ${{ steps.changes.outputs.changed_files }}
146+ TOTAL_MDX_FILES : ${{ steps.changes.outputs.total_mdx_files }}
147+ WORKFLOW_NAME : ${{ github.workflow }}
148+ REPOSITORY : ${{ github.repository }}
149+ RUN_ID : ${{ github.run_id }}
150+ run : bash scripts/create-sdk-reference-sync-pr.sh
205151
206152 - name : Summary
207153 env :
@@ -213,8 +159,8 @@ jobs:
213159 CHANGES : ${{ steps.changes.outputs.changes }}
214160 CHANGED_FILES : ${{ steps.changes.outputs.changed_files }}
215161 TOTAL_MDX_FILES : ${{ steps.changes.outputs.total_mdx_files }}
216- PR_OPERATION : ${{ steps.cpr .outputs.pull-request- operation }}
217- PR_URL : ${{ steps.cpr .outputs.pull-request- url }}
162+ PR_OPERATION : ${{ steps.pr .outputs.operation }}
163+ PR_URL : ${{ steps.pr .outputs.url }}
218164 run : |
219165 echo "## SDK Reference Generation Complete" >> $GITHUB_STEP_SUMMARY
220166 echo "" >> $GITHUB_STEP_SUMMARY
0 commit comments