-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
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! |
Just guessing, maybe move all commands and lines of bash code into jobs/post_checkout section will help? |
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Hm, looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should have posted the full version right away :)
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 |
Interesting... It seems it works fine with |
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$ |
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 |
I have no idea what is going on :) |
Today we are deploying a change on Read the Docs that should fix this. Hopefully, it works 🤞🏼 |
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. |
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? |
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/ |
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;
fi Any ideas why this didn't skip? |
As suggested by @humitos at #103843 (comment), 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.https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition