Uses built-in RTD vars. https://docs.readthedocs.io/en/stable/environment-variables.html.
Follow up to https://github.com/ceph/ceph/pull/46917#discussion_r942359130.
Signed-off-by: David Galloway <dgallowa@redhat.com>
# See .readthedocs.yml
set -ex
-if git symbolic-ref HEAD; then
+re='^[0-9]+$'
+if [[ $READTHEDOCS_VERSION =~ $re ]]; then
+ echo "Building docs for PR $READTHEDOCS_VERSION. Will not check out doc/releases from main branch."
+else
+ echo "Building docs for $READTHEDOCS_VERSION branch. Will check out doc/releases from main branch."
git checkout origin/main -- doc/releases
fi
git status