Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugovk merged 10 commits intopython:mainfromhugovk:rtd-doc-dir-only
May 24, 2023

Conversation

hugovk
Copy link
Member

As suggested by@humitos at#103843 (comment), cancel building pull requests when there aren't changes in theDoc 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

@hugovk
Copy link
MemberAuthor

For the first commit:

Problem in your project's configuration. Invalid "build.commands": .readthedocs.yml: The keys build.jobs and build.commands can't be used together.

https://readthedocs.org/projects/cpython-previews/builds/20362322/

For the second:

We encountered a problem with a command while building your project. To resolve this error, double check your project configuration and installed dependencies are correct and have not changed recently.
...
/bin/sh: 1: if: not found
/bin/sh: 2: Syntax error: "then" unexpected

https://readthedocs.org/projects/cpython-previews/builds/20362458/

@humitos Any suggestions? Thank you!

@Eclips4
Copy link
Member

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>
@sobolevn
Copy link
Member

Hm, looks likesh cannot handle] && expr case. Better use[ ] twice.

Copy link
Member

@sobolevnsobolevn left a 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 :)

hugovk reacted with thumbs up emoji
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@humitos
Copy link
Contributor

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 frombuild.jobs.post_ should work as a workaround.

hugovk reacted with thumbs up emoji

@humitos
Copy link
Contributor

Interesting... It seems it works fine withbuild.jobs (I tested it again athttps://readthedocs.org/projects/test-builds/builds/20716439/) but it doesn't withbuild.commands for some reason. I will need to keep researching about this and I will come back, hopefully, with a solution 😄

hugovk reacted with thumbs up emoji

@sobolevn
Copy link
Member

It works locally, maybe this is some kind ofyaml issue?

sh-3.2$if ["$READTHEDOCS_VERSION_TYPE"="external" ]&& ["$(git diff --quiet origin/main -- Doc/ .readthedocs.yml;echo$?)"-eq 0 ];then>echo 1>fish-3.2$

@sobolevn
Copy link
Member

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
Copy link
Member

I have no idea what is going on :)
Maybe we are missing something obvious?

@hugovkhugovk marked this pull request as draftMay 21, 2023 20:03
@humitos
Copy link
Contributor

Today we are deploying a change on Read the Docs that should fix this. Hopefully, it works 🤞🏼

arhadthedev and hugovk reacted with thumbs up emoji

@humitos
Copy link
Contributor

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.

@hugovkhugovk marked this pull request as ready for reviewMay 23, 2023 19:27
@hugovkhugovk merged commitc3204ed intopython:mainMay 24, 2023
@hugovkhugovk deleted the rtd-doc-dir-only branchMay 24, 2023 13:54
@hugovk
Copy link
MemberAuthor

This is working quite well, thanks!

One thing though, for example on#105008 (comment), the build was cancelled as expected:

Detailsimage

https://readthedocs.org/projects/cpython-previews/builds/20835824/

However, the status check on GitHub still shows as pending:

Detailsimage

And also shows in the tab:

Detailsimage

Would it be possible to have it report as skipped instead of pending?

AlexWaygood and humitos reacted with thumbs up emoji

@humitos
Copy link
Contributor

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 inhttps://github.com/readthedocs/readthedocs.org/

@hugovk
Copy link
MemberAuthor

Thanks, reported:readthedocs/readthedocs.org#10364


Another PR had noDoc/ or.readthedocs.yml changes but still built the docs preview:

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;fi

Any ideas why this didn't skip?

erlend-aasland reacted with eyes emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@humitoshumitoshumitos left review comments

@sobolevnsobolevnsobolevn left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@hugovk@Eclips4@sobolevn@humitos@bedevere-bot@arhadthedev

[8]ページ先頭

©2009-2025 Movatter.jp