Skip to content

Commit 09af4fa

Browse files
committed
Fix CI mermaid validation sandbox
1 parent 97ccd66 commit 09af4fa

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

scripts/validate_quality.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ def mermaid_command() -> list[str] | None:
9494
return None
9595

9696

97+
def mermaid_puppeteer_config(out_dir: Path) -> Path:
98+
config_path = out_dir / "puppeteer-config.json"
99+
config_path.write_text(
100+
json.dumps({"args": ["--no-sandbox", "--disable-setuid-sandbox"]}),
101+
encoding="utf-8",
102+
)
103+
return config_path
104+
105+
97106
def validate_mermaid(skip: bool) -> None:
98107
diagrams = iter_files(".mmd")
99108
if not diagrams:
@@ -106,8 +115,15 @@ def validate_mermaid(skip: bool) -> None:
106115
return
107116
with tempfile.TemporaryDirectory(prefix="skill-mermaid-") as tmp:
108117
out_dir = Path(tmp)
118+
puppeteer_config = mermaid_puppeteer_config(out_dir)
109119
for index, path in enumerate(diagrams, start=1):
110-
run([*cmd, "-i", str(path), "-o", str(out_dir / f"diagram-{index}.svg"), "-b", "white"])
120+
run([
121+
*cmd,
122+
"-i", str(path),
123+
"-o", str(out_dir / f"diagram-{index}.svg"),
124+
"-b", "white",
125+
"-p", str(puppeteer_config),
126+
])
111127
print("mermaid ok")
112128

113129

0 commit comments

Comments
 (0)