Spaces:
Running
Running
Jeremiah Lowin Claude commited on
Move SDK docs generation to post-merge workflow (#1513)
Browse files
.github/workflows/run-static.yml
CHANGED
|
@@ -42,8 +42,6 @@ jobs:
|
|
| 42 |
python-version: "3.12"
|
| 43 |
- name: Install dependencies
|
| 44 |
run: uv sync --dev
|
| 45 |
-
- name: Install just
|
| 46 |
-
uses: extractions/setup-just@v3
|
| 47 |
- name: Check lockfile is up to date
|
| 48 |
run: |
|
| 49 |
if ! uv lock --check; then
|
|
@@ -56,33 +54,3 @@ jobs:
|
|
| 56 |
uses: pre-commit/action@v3.0.1
|
| 57 |
env:
|
| 58 |
SKIP: no-commit-to-branch
|
| 59 |
-
- name: Check SDK documentation is up to date
|
| 60 |
-
run: |
|
| 61 |
-
# Save original docs.json for comparison
|
| 62 |
-
cp docs/docs.json docs/docs.json.orig
|
| 63 |
-
|
| 64 |
-
# Generate documentation
|
| 65 |
-
just api-ref-all > /dev/null 2>&1
|
| 66 |
-
|
| 67 |
-
# Check if python-sdk files changed
|
| 68 |
-
if ! git diff --quiet docs/python-sdk/; then
|
| 69 |
-
echo "❌ SDK documentation is out of date!"
|
| 70 |
-
echo "Files that were updated:"
|
| 71 |
-
git diff --name-only docs/python-sdk/
|
| 72 |
-
echo ""
|
| 73 |
-
echo "Run `just api-ref-all` to regenerate the SDK docs, then commit the changes. Note: you may need to install `just` (https://github.com/casey/just)"
|
| 74 |
-
exit 1
|
| 75 |
-
fi
|
| 76 |
-
|
| 77 |
-
# Check if docs.json content changed (ignoring formatting)
|
| 78 |
-
if ! jq --sort-keys . docs/docs.json.orig | diff -q - <(jq --sort-keys . docs/docs.json) > /dev/null 2>&1; then
|
| 79 |
-
echo "❌ docs.json content has changed!"
|
| 80 |
-
echo ""
|
| 81 |
-
echo "Run `just api-ref-all` to regenerate the SDK docs, then commit the changes. Note: you may need to install `just` (https://github.com/casey/just)"
|
| 82 |
-
exit 1
|
| 83 |
-
fi
|
| 84 |
-
|
| 85 |
-
# Restore original docs.json to avoid false positives
|
| 86 |
-
mv docs/docs.json.orig docs/docs.json
|
| 87 |
-
|
| 88 |
-
echo "✅ SDK documentation is up to date"
|
|
|
|
| 42 |
python-version: "3.12"
|
| 43 |
- name: Install dependencies
|
| 44 |
run: uv sync --dev
|
|
|
|
|
|
|
| 45 |
- name: Check lockfile is up to date
|
| 46 |
run: |
|
| 47 |
if ! uv lock --check; then
|
|
|
|
| 54 |
uses: pre-commit/action@v3.0.1
|
| 55 |
env:
|
| 56 |
SKIP: no-commit-to-branch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/update-sdk-docs.yml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Update SDK Documentation
|
| 2 |
+
|
| 3 |
+
# This workflow runs on merges to main to automatically update SDK docs
|
| 4 |
+
# without blocking PRs. SDK doc generation can fail if another PR merges
|
| 5 |
+
# first, so handling it post-merge prevents annoying CI failures for contributors.
|
| 6 |
+
|
| 7 |
+
on:
|
| 8 |
+
push:
|
| 9 |
+
branches: ["main"]
|
| 10 |
+
paths:
|
| 11 |
+
- "src/**"
|
| 12 |
+
- "pyproject.toml"
|
| 13 |
+
workflow_dispatch:
|
| 14 |
+
|
| 15 |
+
permissions:
|
| 16 |
+
contents: write
|
| 17 |
+
pull-requests: write
|
| 18 |
+
|
| 19 |
+
jobs:
|
| 20 |
+
update-sdk-docs:
|
| 21 |
+
timeout-minutes: 5
|
| 22 |
+
runs-on: ubuntu-latest
|
| 23 |
+
|
| 24 |
+
steps:
|
| 25 |
+
- uses: actions/checkout@v4
|
| 26 |
+
with:
|
| 27 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
| 28 |
+
|
| 29 |
+
- name: Install uv
|
| 30 |
+
uses: astral-sh/setup-uv@v6
|
| 31 |
+
with:
|
| 32 |
+
enable-cache: true
|
| 33 |
+
cache-dependency-glob: "uv.lock"
|
| 34 |
+
|
| 35 |
+
- name: Set up Python
|
| 36 |
+
uses: actions/setup-python@v5
|
| 37 |
+
with:
|
| 38 |
+
python-version: "3.12"
|
| 39 |
+
|
| 40 |
+
- name: Install dependencies
|
| 41 |
+
run: uv sync --dev
|
| 42 |
+
|
| 43 |
+
- name: Install just
|
| 44 |
+
uses: extractions/setup-just@v3
|
| 45 |
+
|
| 46 |
+
- name: Generate SDK documentation
|
| 47 |
+
run: |
|
| 48 |
+
echo "🔄 Generating SDK documentation..."
|
| 49 |
+
just api-ref-all
|
| 50 |
+
|
| 51 |
+
- name: Check for changes
|
| 52 |
+
id: check_changes
|
| 53 |
+
run: |
|
| 54 |
+
if git diff --quiet docs/python-sdk/ docs/docs.json; then
|
| 55 |
+
echo "No changes detected in SDK documentation"
|
| 56 |
+
echo "has_changes=false" >> $GITHUB_OUTPUT
|
| 57 |
+
else
|
| 58 |
+
echo "Changes detected in SDK documentation"
|
| 59 |
+
echo "has_changes=true" >> $GITHUB_OUTPUT
|
| 60 |
+
fi
|
| 61 |
+
|
| 62 |
+
- name: Commit and push changes
|
| 63 |
+
if: steps.check_changes.outputs.has_changes == 'true'
|
| 64 |
+
run: |
|
| 65 |
+
git config --local user.email "action@github.com"
|
| 66 |
+
git config --local user.name "GitHub Action"
|
| 67 |
+
git add docs/python-sdk/ docs/docs.json
|
| 68 |
+
git commit -m "chore: Update SDK documentation
|
| 69 |
+
|
| 70 |
+
🤖 Generated with [Claude Code](https://claude.ai/code)
|
| 71 |
+
|
| 72 |
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
| 73 |
+
git push
|
| 74 |
+
|
| 75 |
+
- name: Summary
|
| 76 |
+
run: |
|
| 77 |
+
if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then
|
| 78 |
+
echo "✅ SDK documentation updated and committed"
|
| 79 |
+
else
|
| 80 |
+
echo "✅ SDK documentation is already up to date"
|
| 81 |
+
fi
|