File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,32 @@ echo "github url: ${github_url}"
3232echo " github user: ${github_user} "
3333echo " github repo: ${github_repo} "
3434
35+ # For non PR builds, create a dummy index.html and exit early
36+ # ReadTheDocs sets READTHEDOCS_VERSION_TYPE to "external" for PR/external builds
37+ rtd_version_type=" ${READTHEDOCS_VERSION_TYPE:- } "
38+ echo " ReadTheDocs version type: ${rtd_version_type} "
39+ if [[ " ${rtd_version_type} " != " external" ]]; then
40+ echo " Not a pull request build, creating dummy index.html"
41+ output_dir=" ${READTHEDOCS_OUTPUT} html"
42+ mkdir -p " ${output_dir} "
43+ cat > " ${output_dir} /index.html" << 'EOF '
44+ <!DOCTYPE html>
45+ <html lang="en">
46+ <head>
47+ <meta charset="UTF-8">
48+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
49+ <title>Preview not available</title>
50+ </head>
51+ <body>
52+ <h1>Preview not available</h1>
53+ <p>Previews are only generated for pull requests.</p>
54+ </body>
55+ </html>
56+ EOF
57+ echo " Dummy index.html written to ${output_dir} "
58+ exit 0
59+ fi
60+
3561# set default directories
3662project_dir=" ."
3763theme_dir=" ."
You can’t perform that action at this time.
0 commit comments