File tree Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 1414 - name : Checkout repository
1515 id : checkout
1616 uses : actions/checkout@v5
17-
1817 - name : Set up Python
1918 uses : actions/setup-python@v5
2019 id : setup-python
@@ -23,36 +22,30 @@ jobs:
2322 cache : " pip"
2423 cache-dependency-path : " requirements/docs.txt"
2524 check-latest : true
26-
2725 - name : Install dependencies
2826 id : install-deps
2927 run : |
3028 python -m pip install -U pip
3129 pip install ".[docs]"
3230 pip install beautifulsoup4
33-
3431 - name : Build Sphinx HTML docs
3532 id : build-sphinx
3633 run : sphinx-build -b html docs docs/_build/html
37-
3834 - name : Export docs.json
3935 id : generate-json
4036 run : python scripts/docs_json_exporter.py
41-
4237 - name : Upload docs.json as artifact
4338 uses : actions/upload-artifact@v4.6.2
4439 id : artifact-upload
4540 with :
4641 name : Pycord Docs JSON
4742 path : docs.json
4843 retention-days : 1
49-
5044 - name : Show docs.json summary
5145 run : |
5246 head -n 40 docs.json || tail -n 40 docs.json
53-
5447 - name : Output artifact ID
5548 run : |
5649 echo "artifact-id=${{ steps.artifact-upload.outputs.artifact-id }}" >> $GITHUB_OUTPUT
5750 echo "artifact-url=${{ steps.artifact-upload.outputs.artifact-url }}" >> $GITHUB_OUTPUT
58- echo "::notice::Artifact uploaded: ${{ steps.artifact-upload.outputs.artifact-url }}"
51+ echo "::notice::Artifact uploaded: ${{ steps.artifact-upload.outputs.artifact-url }}"
Original file line number Diff line number Diff line change 1-
2- import os
31import json
2+ import os
3+
44from bs4 import BeautifulSoup
55
6+
67def log (msg ):
78 print (f"::notice::{ msg } " )
89
10+
911log ("Starting docs JSON export..." )
1012folders = [
1113 "docs/_build/html/api" ,
@@ -35,10 +37,16 @@ def log(msg):
3537 if not class_name :
3638 class_name = dt .text .split (":" )[- 1 ].strip () if dt else None
3739 members = []
38- for member_dl in class_dl .find_all ("dl" , class_ = ["attribute" , "method" ]):
40+ for member_dl in class_dl .find_all (
41+ "dl" , class_ = ["attribute" , "method" ]
42+ ):
3943 for member_dt in member_dl .find_all ("dt" ):
4044 member_id = member_dt .get ("id" )
41- member_name = member_id .split ("." )[- 1 ] if member_id else member_dt .text .split (":" )[- 1 ].strip ()
45+ member_name = (
46+ member_id .split ("." )[- 1 ]
47+ if member_id
48+ else member_dt .text .split (":" )[- 1 ].strip ()
49+ )
4250 if member_name :
4351 members .append (member_name )
4452 page_index [class_name ] = members
@@ -55,4 +63,4 @@ def log(msg):
5563 log ("Exported docs to docs.json" )
5664 log ("To upload as artifact: docs.json" )
5765except Exception as e :
58- print (f"::error::Docs JSON export failed: { e } " )
66+ print (f"::error::Docs JSON export failed: { e } " )
You can’t perform that action at this time.
0 commit comments