@@ -219,6 +219,7 @@ jobs:
219219 trigger_build() {
220220 local version_slug="$1"
221221
222+ echo "Triggering Read the Docs build for version slug '${version_slug}'."
222223 curl \
223224 --fail-with-body \
224225 --silent \
@@ -254,12 +255,14 @@ jobs:
254255
255256 active="$(jq -r '.active' version.json)"
256257 hidden="$(jq -r '.hidden' version.json)"
258+ echo "Read the Docs version '${version_slug}' status: active=${active}, hidden=${hidden}."
257259
258260 if [[ "${active}" == "true" && "${hidden}" == "false" ]]; then
259261 trigger_build "${version_slug}"
260262 exit 0
261263 fi
262264
265+ echo "Activating and unhiding Read the Docs version '${version_slug}'."
263266 curl \
264267 --fail-with-body \
265268 --silent \
@@ -270,6 +273,23 @@ jobs:
270273 --data '{"active": true, "hidden": false}' \
271274 "${api_base}/versions/${version_slug}/"
272275
273- if [[ "${active}" == "true" ]]; then
276+ status_code="$(get_version_details "${version_slug}")"
277+
278+ if [[ "${status_code}" != "200" ]]; then
279+ echo "Failed to re-fetch Read the Docs version details for '${version_slug}' after PATCH."
280+ cat version.json
281+ exit 1
282+ fi
283+
284+ active="$(jq -r '.active' version.json)"
285+ hidden="$(jq -r '.hidden' version.json)"
286+ echo "Read the Docs version '${version_slug}' updated status: active=${active}, hidden=${hidden}."
287+
288+ if [[ "${active}" == "true" && "${hidden}" == "false" ]]; then
274289 trigger_build "${version_slug}"
290+ exit 0
275291 fi
292+
293+ echo "Read the Docs version '${version_slug}' is still not buildable after PATCH."
294+ cat version.json
295+ exit 1
0 commit comments