RtD docs previews: Cancel building PRs if no changes in Doc dir#104100
Conversation
|
For the first commit:
https://readthedocs.org/projects/cpython-previews/builds/20362322/ For the second:
https://readthedocs.org/projects/cpython-previews/builds/20362458/ @humitos Any suggestions? Thank you! |
Sorry, something went wrong.
|
Just guessing, maybe move all commands and lines of bash code into jobs/post_checkout section will help? |
Sorry, something went wrong.
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
Hm, looks like |
Sorry, something went wrong.
sobolevn
left a comment
There was a problem hiding this comment.
Sorry, I should have posted the full version right away :)
Sorry, something went wrong.
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
Hi! Sorry for the late reply. I've been on vacations and then Write the Docs conference after that. I was 100% sure that we already solved the problem you are facing, but I just found that we reverted the change because it was causing other issues (readthedocs/readthedocs.org#10206). I'm sorry for the confusion here. As @Eclips4 commented, putting this into a script and calling it from |
Sorry, something went wrong.
|
Interesting... It seems it works fine with |
Sorry, something went wrong.
|
It works locally, maybe this is some kind of sh-3.2$ if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; then
> echo 1
> fi
sh-3.2$ |
Sorry, something went wrong.
|
Maybe like this? - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; then \
echo "No changes to Doc/ - exiting the build."; \
exit 183; \
fi |
Sorry, something went wrong.
|
I have no idea what is going on :) |
Sorry, something went wrong.
|
Today we are deploying a change on Read the Docs that should fix this. Hopefully, it works 🤞🏼 |
Sorry, something went wrong.
|
The fix on Read the Docs is already deployed and my tests worked. Can you confirm that it works for you now as well? Note that you have to adapt your command to revert it to the state it was before (multi-line). I will do a suggestion on the PR. |
Sorry, something went wrong.
Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
|
This is working quite well, thanks! One thing though, for example on #105008 (comment), the build was cancelled as expected: https://readthedocs.org/projects/cpython-previews/builds/20835824/ However, the status check on GitHub still shows as pending: And also shows in the tab: Would it be possible to have it report as skipped instead of pending? |
Sorry, something went wrong.
|
Hi @hugovk. This should be reporting success (✅) to GitHub when the build is skipped. It seems we introduced a bug here or something that broke this behavior. If you have the time, please open an issue in https://github.com/readthedocs/readthedocs.org/ |
Sorry, something went wrong.
|
Thanks, reported: readthedocs/readthedocs.org#10364 Another PR had no
We can see the check was there but returned 0: if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ];
then
echo "No changes to Doc/ - exiting the build.";
exit 183;
fiAny ideas why this didn't skip? |
Sorry, something went wrong.



As suggested by @humitos at #103843 (comment), cancel building pull requests when there aren't changes in the
Docdirectory.If there are no changes (
git diffexits 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.https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition