Uh oh!
There was an error while loading. Please reload this page.
RtD docs previews: Cancel building PRs if no changes in Doc dir - #104100
Conversation
hugovk
commented
May 2, 2023
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! |
Eclips4
commented
May 2, 2023
Just guessing, maybe move all commands and lines of bash code into jobs/post_checkout section will help? |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
sobolevn
commented
May 12, 2023
Hm, looks like |
sobolevn
left a comment
There was a problem hiding this comment.
Sorry, I should have posted the full version right away :)
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
humitos
commented
May 15, 2023
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 |
humitos
commented
May 15, 2023
Interesting... It seems it works fine with |
sobolevn
commented
May 16, 2023
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$ |
sobolevn
commented
May 16, 2023
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 |
sobolevn
commented
May 16, 2023
I have no idea what is going on :) |
humitos
commented
May 23, 2023
Today we are deploying a change on Read the Docs that should fix this. Hopefully, it works 🤞🏼 |
humitos
commented
May 23, 2023
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. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
hugovk
commented
May 27, 2023
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? |
humitos
commented
May 29, 2023
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/ |
hugovk
commented
May 29, 2023
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 ];thenecho"No changes to Doc/ - exiting the build.";exit 183;fiAny ideas why this didn't skip? |



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