Skip to content

Commit 1713735

Browse files
committed
ci(api-docs): make API-reference update fire on python-sdk release only
Drop the weekly cron and manual workflow_dispatch triggers; the workflow now runs solely on a repository_dispatch (event-type: sdk-release) sent by python-sdk's release workflow after it publishes, carrying the released tag in client_payload.ref. Resolve the ref from the dispatch payload (with a latest-tag fallback) and regenerate + PR the reference against that release.
1 parent 5333c30 commit 1713735

1 file changed

Lines changed: 22 additions & 28 deletions

File tree

.github/workflows/update-api-docs.yml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
name: Update Python API reference
22

3-
# Regenerates src/content/docs/reference/python-api/*.md from the python-sdk
4-
# release and opens a PR when anything changed. This keeps the *source-controlled*
5-
# API reference matched to the SDK; the deploy workflow regenerates the same docs
3+
# Regenerates src/content/docs/reference/python-api/*.md from a python-sdk release
4+
# and opens a PR when anything changed. This keeps the *source-controlled* API
5+
# reference matched to the SDK; the deploy workflow regenerates the same docs
66
# ephemerally for the published build, but never commits them back.
77
#
8-
# Triggers:
9-
# - repository_dispatch (sdk-release): fired by python-sdk's release workflow.
10-
# Send the released ref in client_payload.ref, e.g. from python-sdk:
11-
# - uses: peter-evans/repository-dispatch@v3
12-
# with:
13-
# token: ${{ secrets.DOCS_DISPATCH_TOKEN }} # PAT with repo scope on the docs repo
14-
# repository: codellm-devkit/docs
15-
# event-type: sdk-release
16-
# client-payload: '{"ref": "${{ github.ref_name }}"}'
17-
# - workflow_dispatch: manual run, with an optional ref (tag/branch/sha).
18-
# - schedule: weekly safety net in case a release dispatch is ever missed.
8+
# Trigger: a python-sdk *release* only. python-sdk's release workflow
9+
# (.github/workflows/release.yml) sends a repository_dispatch after it publishes,
10+
# carrying the released tag in client_payload.ref:
11+
#
12+
# - name: Trigger docs API-reference update
13+
# uses: peter-evans/repository-dispatch@v3
14+
# with:
15+
# token: ${{ secrets.DOCS_DISPATCH_TOKEN }} # PAT/fine-grained token with
16+
# # contents:write on codellm-devkit/docs
17+
# repository: codellm-devkit/docs
18+
# event-type: sdk-release
19+
# client-payload: '{"ref": "${{ github.ref_name }}"}'
1920

2021
on:
2122
repository_dispatch:
2223
types: [sdk-release]
23-
workflow_dispatch:
24-
inputs:
25-
ref:
26-
description: "python-sdk ref to generate from (tag/branch/sha). Defaults to the latest release tag."
27-
required: false
28-
default: ""
29-
schedule:
30-
- cron: "0 6 * * 1" # Mondays 06:00 UTC
3124

3225
permissions:
3326
contents: write
@@ -51,18 +44,19 @@ jobs:
5144
with:
5245
python-version: "3.12"
5346

54-
- name: Clone python-sdk at the target ref
47+
- name: Clone python-sdk at the released tag
5548
id: sdk
5649
run: |
5750
set -euo pipefail
5851
git clone https://github.com/codellm-devkit/python-sdk.git ../python-sdk
5952
cd ../python-sdk
60-
# Precedence: repository_dispatch payload > workflow_dispatch input > latest release tag.
61-
REF="${{ github.event.client_payload.ref || github.event.inputs.ref }}"
53+
# The release workflow sends the released tag in client_payload.ref.
54+
# Fall back to the latest release tag if a dispatch ever arrives without one.
55+
REF="${{ github.event.client_payload.ref }}"
6256
if [ -z "${REF}" ]; then
6357
REF=$(git tag --sort=-v:refname | head -n1)
6458
fi
65-
echo "Generating API reference from python-sdk ref: ${REF}"
59+
echo "Generating API reference from python-sdk release: ${REF}"
6660
git checkout "${REF}"
6761
SDK_VERSION=$(python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
6862
echo "ref=${REF}" >> "$GITHUB_OUTPUT"
@@ -90,8 +84,8 @@ jobs:
9084
commit-message: "docs(api): sync Python API reference to python-sdk ${{ steps.sdk.outputs.version }}"
9185
title: "docs(api): sync Python API reference to python-sdk ${{ steps.sdk.outputs.version }}"
9286
body: |
93-
Automated regeneration of the Python API reference from
94-
[`python-sdk`](https://github.com/codellm-devkit/python-sdk) ref
87+
Automated regeneration of the Python API reference from the
88+
[`python-sdk`](https://github.com/codellm-devkit/python-sdk) release
9589
`${{ steps.sdk.outputs.ref }}` (version `${{ steps.sdk.outputs.version }}`).
9690
9791
Generated by `scripts/gen_api_docs.py` (griffe). Authored intros above the

0 commit comments

Comments
 (0)