| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -12,23 +12,47 @@ build: | |
| tools: | ||
| 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; echo $?)" -eq 0 ]; | ||
| then | ||
| echo "No changes to Doc/ - exiting the build."; | ||
| exit 183; | ||
| fi | ||
|
|
||
| - asdf plugin add uv | ||
| - asdf install uv latest | ||
| - asdf global uv latest | ||
| - make -C Doc venv html | ||
| - mkdir _readthedocs | ||
| - mv Doc/build/html _readthedocs/html | ||
| jobs: | ||
| post_checkout: | ||
| # https://docs.readthedocs.com/platform/stable/guides/build/skip-build.html#skip-builds-based-on-conditions | ||
| # | ||
| # Cancel building pull requests when there aren't changes in the Doc | ||
| # directory or RTD configuration, or if we can't cleanly merge the base | ||
| # branch. | ||
| - | | ||
| set -eEux; | ||
| if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; | ||
| then | ||
| base_branch=main; | ||
| git fetch --depth=50 origin $base_branch:origin-$base_branch; | ||
| for attempt in $(seq 10); | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI think @StanFromIreland added a bash script for progressive unshallowing some time ago based on my experiments elsewhere. We could probably reuse that.
Sorry, something went wrong.
zware reacted with rocket emoji
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityOh, he embedded bash in YAML: #147975 (comment). But perhaps, if it's extracted into Tools/, we could deduplicate the logic.
Sorry, something went wrong.
StanFromIreland reacted with thumbs up emoji
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityDeduplicating sounds good, but I think I'll leave that for a later cleanup.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAck. A follow-up sounds good.
Sorry, something went wrong.
All reactions
|
||
| do | ||
| if ! git merge-base HEAD origin-$base_branch; | ||
| then | ||
| git fetch --deepen=50 origin $base_branch; | ||
|
Comment thread
webknjaz marked this conversation as resolved.
|
||
| else | ||
| break; | ||
| fi; | ||
| done; | ||
| if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin-$base_branch; | ||
| then | ||
| echo "Unsuccessful merge with '$base_branch' branch, skipping the build"; | ||
| exit 183; | ||
| fi; | ||
| if git diff --exit-code --stat origin-$base_branch -- Doc/ .readthedocs.yml; | ||
| then | ||
| echo "No changes to Doc/ - skipping the build."; | ||
| exit 183; | ||
| fi; | ||
| fi; | ||
| create_environment: | ||
| - echo "Skipping default environment creation" | ||
| install: | ||
| - asdf plugin add uv | ||
| - asdf install uv latest | ||
| - asdf global uv latest | ||
| build: | ||
| html: | ||
| - make -C Doc venv html | ||
| - mkdir -p "$READTHEDOCS_OUTPUT" | ||
| - mv Doc/build/html "$READTHEDOCS_OUTPUT/" | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIs there an env var that could be used instead of main? I imagine this isn't going to work well in backport PRs unless we check against stable branches.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMy plan is to manually set base_branch to the right branch in each backport; I'm afraid RTD doesn't provide the base branch anywhere (that's documented, anyway).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAlright, that works as a workaround. Though, I'd rather have RTD fix it.
curl -s https://api.github.com/repos/python/cpython/pulls/149429 | jq --raw-output '.base.ref' will get you what you want unless they rate-limit you (which is likely).
GHA provides a GITHUB_EVENT_PATH env var with a file path to the entire webhook payload. RTD should do the same so that people wouldn't have to ask them to expose every single bit that GH sends them w/o additional API requests one by one.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityOh I just saw this discussion, I wrote #150690 with it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.