From 8df523351f6e665ea5b07f1b731aa2449d197624 Mon Sep 17 00:00:00 2001 From: Harry Mellor <19981378+hmellor@users.noreply.github.com> Date: Thu, 5 Mar 2026 13:58:16 +0000 Subject: [PATCH] [Docs] Only build docs if `documentation` or `ready` labels are present (#36135) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- .readthedocs.yaml | 1 + docs/maybe_skip_pr_build.sh | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 docs/maybe_skip_pr_build.sh diff --git a/.readthedocs.yaml b/.readthedocs.yaml index f372a3fb8..366f9c8bc 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,6 +9,7 @@ build: python: "3.12" jobs: post_checkout: + - bash docs/maybe_skip_pr_build.sh - git fetch origin main --unshallow --no-tags --filter=blob:none || true pre_create_environment: - pip install uv diff --git a/docs/maybe_skip_pr_build.sh b/docs/maybe_skip_pr_build.sh new file mode 100755 index 000000000..d9872a1ef --- /dev/null +++ b/docs/maybe_skip_pr_build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# Skip PR builds unless the PR has the "documentation" or "ready" label. +# Used by Read the Docs (see .readthedocs.yaml). + +if [[ "$READTHEDOCS_VERSION_TYPE" != "external" ]]; then + exit 0 +fi + +PR_URL="https://api.github.com/repos/vllm-project/vllm/pulls/${READTHEDOCS_VERSION}" +CURL_ARGS=(-s -o /tmp/pr_response.json -w "%{http_code}") +if [[ -n "$GITHUB_TOKEN" ]]; then + CURL_ARGS+=(-H "Authorization: token ${GITHUB_TOKEN}") +fi +HTTP_CODE=$(curl "${CURL_ARGS[@]}" "$PR_URL") + +if [[ "$HTTP_CODE" -ne 200 ]]; then + echo "GitHub API returned HTTP ${HTTP_CODE}, proceeding with build." +elif grep -qE '"name": *"(documentation|ready)"' /tmp/pr_response.json; then + echo "Found required label, proceeding with build." +else + echo "PR #${READTHEDOCS_VERSION} lacks 'documentation' or 'ready' label, skipping build." + exit 183 +fi