]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
RTD Previews: Get correct base branch for backports (#150690)
authorStan Ulbrych <stan@python.org>
Sun, 21 Jun 2026 13:33:42 +0000 (14:33 +0100)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2026 13:33:42 +0000 (16:33 +0300)
.readthedocs.yml

index 3b8a30c0251873ce122d8e4be098f352e1945e25..038417e4bb3438529084e0a2736457808e9a7a6d 100644 (file)
@@ -11,19 +11,21 @@ build:
   os: ubuntu-24.04
   tools:
     python: "3"
+  apt_packages:
+    - jq
 
   jobs:
-    post_checkout:
+    post_system_dependencies:
       # 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
+      # Cancel building pull requests when there are no 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;
+          base_branch=$(wget -qO- "https://api.github.com/repos/python/cpython/pulls/$READTHEDOCS_VERSION" | jq -er ".base.ref");
           git fetch --depth=50 origin $base_branch:origin-$base_branch;
           for attempt in $(seq 10);
           do