-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (61 loc) · 2.79 KB
/
Copy pathpython-reference.yml
File metadata and controls
69 lines (61 loc) · 2.79 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
name: python-reference
# Regenerate the Python SDK API reference page from the lightpanda-python main
# branch and open a pull request when the output changed. The page is
# src/content/reference/python.mdx, written by
# scripts/generate-python-reference.py with pdoc's Python API, so it renders
# like any other docs page and goes live at
# https://lightpanda.io/docs/reference/python once the website bumps its
# docs submodule like any other docs change. The package imports without a
# browser binary, so none is needed here. Runs daily to pick up new package
# changes, by hand, or as a smoke run when the generator itself changes.
on:
schedule:
- cron: "17 6 * * *"
workflow_dispatch:
pull_request:
paths:
- scripts/generate-python-reference.py
- .github/workflows/python-reference.yml
permissions:
contents: write
pull-requests: write
concurrency:
group: python-reference
cancel-in-progress: true
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Generate the reference page
id: generate
run: |
sha=$(git ls-remote https://github.com/lightpanda-io/lightpanda-python.git refs/heads/main | cut -f1)
uv run --no-project --python 3.13 --with 'pdoc==16.0.0' \
--with "git+https://github.com/lightpanda-io/lightpanda-python@$sha" \
python scripts/generate-python-reference.py
echo "sha=${sha::7}" >> "$GITHUB_OUTPUT"
git status --short src/content/reference/python.mdx
- name: Open a pull request if the reference changed
if: github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
SHA: ${{ steps.generate.outputs.sha }}
run: |
if [ -z "$(git status --porcelain src/content/reference/python.mdx)" ]; then
echo "reference already matches lightpanda-python $SHA"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B python-reference
git add src/content/reference/python.mdx
git commit -m "Update the Python SDK API reference to lightpanda-python $SHA"
git push --force origin python-reference
if [ -z "$(gh pr list --head python-reference --state open --json number -q '.[].number')" ]; then
gh pr create --base main --head python-reference \
--title "Update the Python SDK API reference to lightpanda-python $SHA" \
--body "Regenerated \`src/content/reference/python.mdx\` from lightpanda-python $SHA. Served at https://lightpanda.io/docs/reference/python after the website's submodule bump."
fi