From 58a620aa88dd8e47bccca2e436fc8c9698b48461 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Mon, 5 Jan 2026 16:52:00 -0800 Subject: [PATCH] script: API v2 accepts `position` param rather than `order` --- .github/scripts/sync-rpc-cmds.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/scripts/sync-rpc-cmds.py b/.github/scripts/sync-rpc-cmds.py index a9c3ef31d..1657900dc 100644 --- a/.github/scripts/sync-rpc-cmds.py +++ b/.github/scripts/sync-rpc-cmds.py @@ -47,7 +47,7 @@ def check_renderable(response, action, title): return True -def publishDoc(action, title, body, order, headers): +def publishDoc(action, title, body, position, headers): payload = { "title": title, "type": "basic", @@ -55,45 +55,45 @@ def publishDoc(action, title, body, order, headers): "body": body, }, "category": { - "uri": f"/branches/1/categories/reference/{CATEGORY_SLUG}" + "uri": f"/branches/stable/categories/reference/{CATEGORY_SLUG}" }, "hidden": False, - "order": order, + "position": position, } if action == Action.ADD: payload["slug"] = title response = requests.post(URL + "/reference", json=payload, headers=headers) if response.status_code != 201: - print("❌ HTTP ERROR:", response.status_code) + print(f"❌ HTTP ERROR ({response.status_code}):", title) print(response.text) return if not check_renderable(response, action, title): raise RuntimeError(f"Renderable check failed for {title}") - print("✅ Created", title) + print(f"✅ Created '{title}' at position {position + 1}") elif action == Action.UPDATE: response = requests.patch(f"{URL}/reference/{title}", json=payload, headers=headers) if response.status_code != 200: - print("❌ HTTP ERROR:", response.status_code) + print(f"❌ HTTP ERROR ({response.status_code}):", title) print(response.text) return if not check_renderable(response, action, title): raise RuntimeError(f"Renderable check failed for {title}") - print("✅ Updated", title) + print(f"✅ Updated '{title}' to position {position + 1}") elif action == Action.DELETE: response = requests.delete(f"{URL}/reference/{title}", headers=headers) if response.status_code != 204: - print("❌ DELETE FAILED:", title) + print(f"❌ DELETE FAILED ({response.status_code}):", title) print(response.text) else: - print("🗑️ Deleted", title) + print(f"🗑️ Deleted '{title}' from position {position + 1}") else: print("Invalid action") @@ -139,13 +139,14 @@ def main(): sleep(3) if commands_from_local: - order = 0 + position = 0 for name, file in commands_from_local: with open("doc/" + file) as f: body = f.read() - publishDoc(Action.ADD if name in commands_to_add else Action.UPDATE, name, body, order, headers) - order = order + 1 - sleep(3) + action = Action.ADD if name in commands_to_add else Action.UPDATE + publishDoc(action, name, body, position, headers) + position += 1 + sleep(1) else: print("No commands found in the Manpages block.")