Skip to content

[ci][doc] Let a PR opt into the Read the Docs preview with an @rtd-build commit line - #66805

Merged
dstrodtman merged 3 commits into
masterfrom
doc-1754-rtd-build-opt-in
Oct 14, 2026
Merged

dstrodtman merged 3 commits into
masterfrom
doc-1754-rtd-build-opt-in

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Description

The Read the Docs PR preview skips any PR that changes nothing under doc/ or .readthedocs.yaml. #64547 deliberately left python/ray/ out of that check, to keep code-only PRs off the shared build slots. The trade-off is that a PR that edits only docstrings changes the rendered API reference, yet gets no preview and no render check before merge.

This PR adds an opt-in. If any commit message on the PR has a line that starts with @rtd-build, the post_checkout guard builds the docs. It follows the existing @microcheck commit-line convention. PRs without the line behave exactly as they do today, and the change can only add builds, never skip one that would have run. Ray squash-merges with the PR title and body, so the line never reaches master.

doc/source/ray-contribute/ci.md documents the opt-in next to the existing explanation of when the preview skips.

This PR's own commit carries @rtd-build, so its RtD build log should open with "A commit message in this PR requests a build with @rtd-build". That confirms the new path on the real RtD runner.

Related issues

None. I searched open PRs for readthedocs skip, rtd build, readthedocs.yaml post_checkout, and RTD preview python/ray, and found no overlapping work.

Additional information

Testing. I extracted the post_checkout script from the YAML with yaml.safe_load, exactly as RtD reads it, and ran it under dash, the /bin/sh on RtD's builders. The test repo was a shallow clone with origin/master pinned to the PR's base:

Case Expected Result
Change under python/ray/ only, no line skip (183) 183
Change under python/ray/ only, @rtd-build line build (0) 0
@rtd-build mentioned mid-sentence only skip (183) 183
Line in an earlier commit, later commit without it build (0) 0
Change under doc/ build (0) 0
Branch (non-PR) build build (0) 0

RtD's runner strips surrounding single quotes from arguments, so I also ran the two @rtd-build cases with the quotes removed. Both gave the same result.

The new lines avoid the constructs the existing comment warns the runner drops: no backslash escapes, no printf, and no shell comments inside the block. Pre-commit passed on both files.

AI assistance. This change was drafted with Claude Code. I reviewed every line and ran the tests above.

🤖 Generated with Claude Code

…ild commit line

@rtd-build

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman marked this pull request as ready for review October 7, 2026 18:20
@dstrodtman
dstrodtman requested review from a team as code owners October 7, 2026 18:20
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Oct 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an opt-in mechanism using the @rtd-build keyword in commit messages to trigger Read the Docs preview builds, which is especially useful when changes only affect docstrings. It also documents this feature in the CI contribution guide. The feedback suggests improving the robustness of the commit message check by allowing optional leading whitespace before the keyword.

Comment thread .readthedocs.yaml Outdated
echo "Could not determine merge-base with origin/master; building docs to be safe."
exit 0
fi
if git log --format=%B origin/master..HEAD | grep -q '^@rtd-build'; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the opt-in trigger more robust, consider allowing optional leading whitespace before @rtd-build. Commit messages are sometimes formatted with indentation or bullet points (e.g., when copying from PR descriptions), which would prevent the current strict ^@rtd-build pattern from matching.

        if git log --format=%B origin/master..HEAD | grep -q '^[[:space:]]*@rtd-build'; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bed1f0c: the check now matches ^[[:space:]]*@rtd-build, so an indented line opts in too. Text that only mentions @rtd-build mid-line still does not.

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core devprod labels Oct 7, 2026
dstrodtman and others added 2 commits October 8, 2026 10:03
A commit body pasted from an indented PR description still opts in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman merged commit e00c7f4 into master Oct 14, 2026
6 checks passed
@dstrodtman
dstrodtman deleted the doc-1754-rtd-build-opt-in branch October 14, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants