docs: Update rpc commands sync script as per readme API v2
What changed, and why it matters
This commit updates a GitHub Actions script that publishes Core Lightning's RPC command documentation to the ReadMe documentation platform. It changes API endpoints and authentication format to match ReadMe's newer API version. There is no security-relevant change to the Core Lightning node software, wallet funds, network protocol, or user data.
No security action required. Treat as routine documentation/CI maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies .github/scripts/sync-rpc-cmds.py, a CI helper that synchronizes generated RPC documentation to ReadMe. Changes include: switching from ReadMe API v1 (dash.readme.com/api/v1) to v2 (api.readme.com/v2/branches/stable), updating category slug and endpoint paths, changing HTTP methods (POST /reference, PATCH /reference/{slug}, DELETE /reference/{slug}), wrapping the category field in an object, adding URL-encoding for the category slug, and changing the authorization header from Basic to Bearer. The API key is still sourced from an environment variable. No Core Lightning daemon code, RPC interface, cryptographic handling, or network behavior is affected.
Changed components
.github/scripts/sync-rpc-cmds.pyInspect captured patch +13 / −10
diff --git a/.github/scripts/sync-rpc-cmds.py b/.github/scripts/sync-rpc-cmds.py
index b278ce47..6b606354 100644
--- a/.github/scripts/sync-rpc-cmds.py
+++ b/.github/scripts/sync-rpc-cmds.py
@@ -1,14 +1,15 @@
import os
+from urllib.parse import quote
from time import sleep
import requests
import re
from enum import Enum
# readme url
-URL = "https://dash.readme.com/api/v1"
+URL = "https://api.readme.com/v2/branches/stable"
# category id for API reference
CATEGORY_ID = "685ce4df1df887006ff221c5"
-CATEGORY_SLUG = "json-rpc-apis"
+CATEGORY_SLUG = "JSON-RPC API Reference"
class Action(Enum):
@@ -18,9 +19,9 @@ class Action(Enum):
def getListOfRPCDocs(headers):
- response = requests.get(f"{URL}/categories/{CATEGORY_SLUG}/docs", headers=headers)
+ response = requests.get(f"{URL}/categories/reference/{quote(CATEGORY_SLUG)}/pages", headers=headers)
if response.status_code == 200:
- return response.json()
+ return response.json().get('data', [])
else:
return []
@@ -30,28 +31,30 @@ def publishDoc(action, title, body, order, headers):
"title": title,
"type": "basic",
"body": body,
- "category": CATEGORY_ID,
+ "category": {
+ "id": CATEGORY_ID
+ },
"hidden": False,
"order": order,
}
- # title == slug
if action == Action.ADD:
# create doc
- response = requests.post(URL + "/docs", json=payload, headers=headers)
+ payload['slug'] = title
+ response = requests.post(URL + "/reference", json=payload, headers=headers)
if response.status_code != 201:
print(response.text)
else:
print("Created ", title)
elif action == Action.UPDATE:
# update doc
- response = requests.put(f"{URL}/docs/{title}", json=payload, headers=headers)
+ response = requests.patch(f"{URL}/reference/{title}", json=payload, headers=headers)
if response.status_code != 200:
print(response.text)
else:
print("Updated ", title)
elif action == Action.DELETE:
# delete doc
- response = requests.delete(f"{URL}/docs/{title}", headers=headers)
+ response = requests.delete(f"{URL}/reference/{title}", headers=headers)
if response.status_code != 204:
print(response.text)
else:
@@ -79,7 +82,7 @@ def main():
headers = {
"accept": "application/json",
"content-type": "application/json",
- "authorization": "Basic " + os.environ.get("README_API_KEY"),
+ "Authorization": "Bearer " + os.environ.get("README_API_KEY"),
}
# path to the rst file from where we fetch all the RPC commands
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.