This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6515e6add Update trigger rtd build script and remove old and outdated 
url. Also update script to support building arbitrary branches.
6515e6add is described below

commit 6515e6add1803b59233b9f5678b52c7d39230c70
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Aug 4 12:13:38 2023 +0200

    Update trigger rtd build script and remove old and outdated url. Also
    update script to support building arbitrary branches.
---
 .github/workflows/main.yml   |  6 ++++++
 contrib/trigger_rtd_build.py | 11 ++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 907515f59..5968f3951 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -372,9 +372,15 @@ jobs:
         run: |
           tox -e docs-ci
 
+      - name: Extract branch name
+        id: extract_branch
+        run: |
+          echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> 
$GITHUB_OUTPUT
+
       - name: Trigger ReadTheDocs build
         env:
           RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
+          BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
         run: |
           pip install requests
           python ./contrib/trigger_rtd_build.py
diff --git a/contrib/trigger_rtd_build.py b/contrib/trigger_rtd_build.py
index 044f8bf75..e9e24ecfa 100755
--- a/contrib/trigger_rtd_build.py
+++ b/contrib/trigger_rtd_build.py
@@ -18,14 +18,11 @@ import os
 
 import requests
 
-# Old deprecated API
-url = "https://readthedocs.org/build/8284/";
-r = requests.post(url)
-print(r.text)
-
-# New API (which doesn't apear to be working)
 token = os.environ["RTD_TOKEN"]
+branch = os.environ["BRANCH_NAME"]
+
+print(f"Using branch: {branch}")
 
 url = "https://readthedocs.org/api/v2/webhook/libcloud/87656/";
-r = requests.post(url, data={"token": token, "branches": "trunk"})
+r = requests.post(url, data={"token": token, "branches": branch})
 print(r.text)

Reply via email to