diff --git a/vizro-ai/.readthedocs.yaml b/vizro-ai/.readthedocs.yaml index dd8f1f4ac..3d5eb3376 100644 --- a/vizro-ai/.readthedocs.yaml +++ b/vizro-ai/.readthedocs.yaml @@ -14,3 +14,16 @@ build: - cd vizro-ai/ && hatch run docs:mkdocs build - mkdir --parents $READTHEDOCS_OUTPUT - mv vizro-ai/site/ $READTHEDOCS_OUTPUT/html + jobs: + post_checkout: + # Cancel building pull requests when there aren't changed in the docs directory or YAML file. + # You can add any other files or directories that you'd like here as well, + # like your docs requirements file, or other files that will change your docs build. + # + # If there are no changes (git diff exits with 0) we force the command to return with 183. + # This is a special exit code on Read the Docs that will cancel the build immediately. + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- vizro-ai/docs/ vizro-ai/.readthedocs.yaml; + then + exit 183; + fi diff --git a/vizro-core/.readthedocs.yaml b/vizro-core/.readthedocs.yaml index ac4729794..c0fbbbb3d 100644 --- a/vizro-core/.readthedocs.yaml +++ b/vizro-core/.readthedocs.yaml @@ -14,3 +14,16 @@ build: - cd vizro-core/ && hatch run docs:mkdocs build - mkdir --parents $READTHEDOCS_OUTPUT - mv vizro-core/site/ $READTHEDOCS_OUTPUT/html + jobs: + post_checkout: + # Cancel building pull requests when there aren't changed in the docs directory or YAML file. + # You can add any other files or directories that you'd like here as well, + # like your docs requirements file, or other files that will change your docs build. + # + # If there are no changes (git diff exits with 0) we force the command to return with 183. + # This is a special exit code on Read the Docs that will cancel the build immediately. + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- vizro-core/docs/ vizro-core/.readthedocs.yaml; + then + exit 183; + fi \ No newline at end of file