Skip to content

Commit 0038661

Browse files
chore(actions): minor change so pre-commit can fix (#2898)
* chore(actions): minor change so pre-commit can fix * style(pre-commit): auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 7309e1c commit 0038661

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

.github/workflows/docs-json-export.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
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/[email protected]
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 }}"

scripts/docs_json_exporter.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
2-
import os
31
import json
2+
import os
3+
44
from bs4 import BeautifulSoup
55

6+
67
def log(msg):
78
print(f"::notice::{msg}")
89

10+
911
log("Starting docs JSON export...")
1012
folders = [
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")
5765
except Exception as e:
58-
print(f"::error::Docs JSON export failed: {e}")
66+
print(f"::error::Docs JSON export failed: {e}")

0 commit comments

Comments
 (0)