11#! /bin/bash
22set -e
33
4- LOGFILE=" /tmp/mint-dev-$$ .log"
5- PARSE_TIME=45 # Give Mintlify time to log parsing errors
6- PID=" "
7-
8- # Cleanup function
9- cleanup () {
10- if [ -n " $PID " ] && kill -0 " $PID " 2> /dev/null; then
11- kill " $PID " 2> /dev/null || true
12- sleep 0.5
13- kill -9 " $PID " 2> /dev/null || true
14- fi
15- rm -f " $LOGFILE "
16- }
17-
18- # Trap to ensure cleanup
19- trap cleanup EXIT INT TERM
20-
214# Check if there are any MDX files in the changeset
225if [ -n " $GITHUB_BASE_REF " ]; then
236 # In a PR context, check changed files
@@ -40,53 +23,31 @@ if [ -n "$GITHUB_BASE_REF" ]; then
4023 echo " "
4124fi
4225
43- echo " Starting Mintlify validation..."
44- echo " "
45- echo " Running: mint dev --no-open (will run for ${PARSE_TIME} s to parse all files)"
46- echo " "
47-
48- # Run mint dev with tee to force output writing, timeout after PARSE_TIME seconds
49- # Use timeout if available (Linux), otherwise use gtimeout (macOS with coreutils), or perl as fallback
50- if command -v timeout > /dev/null 2>&1 ; then
51- timeout --preserve-status ${PARSE_TIME} s mint dev --no-open 2>&1 | tee " $LOGFILE " > /dev/null || true
52- elif command -v gtimeout > /dev/null 2>&1 ; then
53- gtimeout --preserve-status ${PARSE_TIME} s mint dev --no-open 2>&1 | tee " $LOGFILE " > /dev/null || true
54- else
55- # Fallback: run mint dev in background and kill after PARSE_TIME
56- mint dev --no-open 2>&1 | tee " $LOGFILE " > /dev/null &
57- PID=$!
58- sleep ${PARSE_TIME}
59- kill " $PID " 2> /dev/null || true
60- wait " $PID " 2> /dev/null || true
61- fi
62-
63- echo " "
64- echo " ✓ Mintlify finished parsing"
26+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
27+ echo " VALIDATING DOCUMENTATION BUILD"
28+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
29+ echo " Running: mint validate"
6530echo " "
6631
67- # Check for parsing errors
68- if grep -q " parsing error" " $LOGFILE " ; then
32+ # Run mint validate - exits with non-zero if there are any errors or warnings
33+ if mint validate; then
34+ echo " "
6935 echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
70- echo " ❌ MINTLIFY PARSING ERRORS DETECTED "
36+ echo " ✅ MINTLIFY VALIDATION PASSED "
7137 echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
72- echo " "
73- echo " Parsing errors found:"
74- echo " "
75- grep " parsing error" " $LOGFILE " | sed ' s/^/ /'
38+ echo " No errors or warnings detected"
39+ else
7640 echo " "
7741 echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
78- echo " 💡 These are Mintlify parsing errors. Please fix them or"
79- echo " file an issue if you believe they are incorrect:"
80- echo " https://github.com/wandb/docs/issues/new"
42+ echo " ❌ MINTLIFY VALIDATION FAILED"
43+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
44+ echo " Errors or warnings were detected. Please fix them or"
45+ echo " file an issue if you believe they are incorrect:"
46+ echo " https://github.com/wandb/docs/issues/new"
8147 echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
82- echo " "
8348 exit 1
8449fi
8550
86- echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
87- echo " ✅ MINTLIFY PARSING VALIDATION PASSED"
88- echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
89- echo " No parsing errors detected by Mintlify"
9051echo " "
9152
9253# Run broken links check
@@ -110,10 +71,11 @@ else
11071 echo " Please fix the broken links reported above"
11172 exit 1
11273fi
74+
11375echo " "
11476echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
11577echo " ✅ ALL VALIDATION CHECKS PASSED"
11678echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
117- echo " - No parsing errors"
79+ echo " - No validation errors or warnings "
11880echo " - No broken links"
11981exit 0
0 commit comments