浏览代码

rtd: skip building docs on PRs with no doc changes

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Gerard Marull-Paretas 3 月之前
父节点
当前提交
3272df4aff
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      .readthedocs.yaml

+ 9 - 0
.readthedocs.yaml

@@ -21,6 +21,15 @@ build:
   os: ubuntu-24.04
   tools:
     python: "3.13"
+  jobs:
+    post_checkout:
+      # Skip build if there are no doc changes in a PR
+      # Ref. https://docs.readthedocs.com/platform/stable/build-customization.html#cancel-build-based-on-a-condition
+      - |
+        if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- docs/ .readthedocs.yaml;
+        then
+          exit 183;
+        fi
 
 sphinx:
     configuration: docs/conf.py