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 14
14
- name : Checkout repository
15
15
id : checkout
16
16
uses : actions/checkout@v5
17
-
18
17
- name : Set up Python
19
18
uses : actions/setup-python@v5
20
19
id : setup-python
@@ -23,36 +22,30 @@ jobs:
23
22
cache : " pip"
24
23
cache-dependency-path : " requirements/docs.txt"
25
24
check-latest : true
26
-
27
25
- name : Install dependencies
28
26
id : install-deps
29
27
run : |
30
28
python -m pip install -U pip
31
29
pip install ".[docs]"
32
30
pip install beautifulsoup4
33
-
34
31
- name : Build Sphinx HTML docs
35
32
id : build-sphinx
36
33
run : sphinx-build -b html docs docs/_build/html
37
-
38
34
- name : Export docs.json
39
35
id : generate-json
40
36
run : python scripts/docs_json_exporter.py
41
-
42
37
- name : Upload docs.json as artifact
43
38
44
39
id : artifact-upload
45
40
with :
46
41
name : Pycord Docs JSON
47
42
path : docs.json
48
43
retention-days : 1
49
-
50
44
- name : Show docs.json summary
51
45
run : |
52
46
head -n 40 docs.json || tail -n 40 docs.json
53
-
54
47
- name : Output artifact ID
55
48
run : |
56
49
echo "artifact-id=${{ steps.artifact-upload.outputs.artifact-id }}" >> $GITHUB_OUTPUT
57
50
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
3
1
import json
2
+ import os
3
+
4
4
from bs4 import BeautifulSoup
5
5
6
+
6
7
def log (msg ):
7
8
print (f"::notice::{ msg } " )
8
9
10
+
9
11
log ("Starting docs JSON export..." )
10
12
folders = [
11
13
"docs/_build/html/api" ,
@@ -35,10 +37,16 @@ def log(msg):
35
37
if not class_name :
36
38
class_name = dt .text .split (":" )[- 1 ].strip () if dt else None
37
39
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
+ ):
39
43
for member_dt in member_dl .find_all ("dt" ):
40
44
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
+ )
42
50
if member_name :
43
51
members .append (member_name )
44
52
page_index [class_name ] = members
@@ -55,4 +63,4 @@ def log(msg):
55
63
log ("Exported docs to docs.json" )
56
64
log ("To upload as artifact: docs.json" )
57
65
except 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