Skip to content

Commit 84826a7

Browse files
committed
fix: configure puppeteer for CI sandbox restrictions
Add puppeteer-config.json with --no-sandbox for GitHub Actions. Update validate-mermaid.sh to use config when available.
1 parent d4cb510 commit 84826a7

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.github/workflows/docs-validation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
else
3131
echo "No Mermaid diagrams to validate"
3232
fi
33+
env:
34+
PUPPETEER_CONFIG: ${{ github.workspace }}/scripts/puppeteer-config.json
3335

3436
lint-markdown:
3537
runs-on: ubuntu-latest

scripts/puppeteer-config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"args": ["--no-sandbox", "--disable-setuid-sandbox"]
3+
}

scripts/validate-mermaid.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ else
2424
MMDC_AVAILABLE=true
2525
fi
2626

27+
MMDC_ARGS=""
28+
if [[ -n "$PUPPETEER_CONFIG" ]] && [[ -f "$PUPPETEER_CONFIG" ]]; then
29+
MMDC_ARGS="-p $PUPPETEER_CONFIG"
30+
echo "Using Puppeteer config: $PUPPETEER_CONFIG"
31+
elif [[ -f "$SCRIPT_DIR/puppeteer-config.json" ]]; then
32+
MMDC_ARGS="-p $SCRIPT_DIR/puppeteer-config.json"
33+
echo "Using Puppeteer config: $SCRIPT_DIR/puppeteer-config.json"
34+
fi
35+
2736
ERRORS=0
2837
TOTAL=0
2938

@@ -55,7 +64,7 @@ validate_markdown_file() {
5564
echo "$mermaid_content" > "$temp_file"
5665

5766
if [[ "$MMDC_AVAILABLE" == true ]]; then
58-
if mmdc -i "$temp_file" -o "$TEMP_DIR/output.svg" 2>"$TEMP_DIR/error.log"; then
67+
if mmdc $MMDC_ARGS -i "$temp_file" -o "$TEMP_DIR/output.svg" 2>"$TEMP_DIR/error.log"; then
5968
echo -e "${GREEN}${NC} $file:$block_start_line (block $block_num)"
6069
else
6170
echo -e "${RED}${NC} $file:$block_start_line (block $block_num)"
@@ -91,7 +100,7 @@ else
91100
for file in $MMD_FILES; do
92101
TOTAL=$((TOTAL + 1))
93102
if [[ "$MMDC_AVAILABLE" == true ]]; then
94-
if mmdc -i "$file" -o "$TEMP_DIR/output.svg" 2>"$TEMP_DIR/error.log"; then
103+
if mmdc $MMDC_ARGS -i "$file" -o "$TEMP_DIR/output.svg" 2>"$TEMP_DIR/error.log"; then
95104
echo -e "${GREEN}${NC} $file"
96105
else
97106
echo -e "${RED}${NC} $file"

0 commit comments

Comments
 (0)