From 77fdac23cb90d3c960525ce9069c6bfeca84848d Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Mon, 13 May 2024 19:11:27 +0200
Subject: [PATCH] doc.py: fix gitlab api use

---
 scripts/doc.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/doc.py b/scripts/doc.py
index 648b877..6d4532b 100755
--- a/scripts/doc.py
+++ b/scripts/doc.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 from io import BytesIO
+from os import environ
 from pathlib import Path
 from zipfile import ZipFile
 
@@ -11,6 +12,7 @@ GITLAB = "https://gitlab.laas.fr"
 RAINBOARD = "https://rainboard.laas.fr"
 INDEX = DOC / "index.html"
 HEAD = DOC / "index.head.html"
+TOKEN = environ["GITLAB_TOKEN"]
 
 if __name__ == "__main__":
     with INDEX.open("w") as f, HEAD.open() as head:
@@ -19,9 +21,11 @@ if __name__ == "__main__":
     for project, namespace, branch in sorted(
         httpx.get(f"{RAINBOARD}/doc").json()["ret"]
     ):
-        url = f"{GITLAB}/{namespace}/{project}/-/jobs/artifacts/{branch}/download"
+        url = f"{GITLAB}/api/v4/projects/{namespace}%2F{project}/jobs/artifacts/{branch}/download"
         path = DOC / namespace / project / branch
-        r = httpx.get(url, params={"job": "doc-coverage"})
+        r = httpx.get(
+            url, params={"job": "doc-coverage"}, headers={"Private-Token": TOKEN}
+        )
         try:
             z = ZipFile(BytesIO(r.content))
             path.mkdir(parents=True, exist_ok=True)
-- 
GitLab