Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RtD docs previews: Cancel building PRs if no changes in Doc dir #104100

Merged
merged 10 commits into from
May 24, 2023
12 changes: 12 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ build:
python: "3"

commands:
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
#
# Cancel building pull requests when there aren't changes in the Doc directory.
#
# 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 -- Doc/ .readthedocs.yml; then
hugovk marked this conversation as resolved.
Show resolved Hide resolved
echo "No changes to Doc/ - exiting the build.";
exit 183;
fi

- make -C Doc venv html
- mkdir _readthedocs
- mv Doc/build/html _readthedocs/html