From c7a07b7a087cfc1d699fa00f61eb2bfc54892bd4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 2 May 2023 21:27:50 +0300 Subject: [PATCH 1/9] Cancel building PRs when there aren't changes in the Doc directory --- .readthedocs.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index 898a9ae89dbb92..5dbc20773645c2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,6 +12,21 @@ build: tools: python: "3" + jobs: + post_checkout: + # https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition + # + # Cancel building pull requests when there aren't changes in the Doc directory. + # + # If there are no changes (git diff exits with 0) we force the command to return with 183. + # This is a special exit code on Read the Docs that will cancel the build immediately. + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; + then + echo "No changes to Doc/ - exiting the build."; + exit 183; + fi + commands: - make -C Doc venv html - mkdir _readthedocs From e610f227f36d03fc0fcf54db51fc36f2e08d9a4d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 2 May 2023 21:52:40 +0300 Subject: [PATCH 2/9] The keys build.jobs and build.commands can't be used together --- .readthedocs.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 5dbc20773645c2..5031003ef21390 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,22 +12,20 @@ build: tools: python: "3" - jobs: - post_checkout: - # https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition - # - # Cancel building pull requests when there aren't changes in the Doc directory. - # - # If there are no changes (git diff exits with 0) we force the command to return with 183. - # This is a special exit code on Read the Docs that will cancel the build immediately. - - | - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; - then - echo "No changes to Doc/ - exiting the build."; - exit 183; - fi - commands: + # https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition + # + # Cancel building pull requests when there aren't changes in the Doc directory. + # + # If there are no changes (git diff exits with 0) we force the command to return with 183. + # This is a special exit code on Read the Docs that will cancel the build immediately. + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; + then + echo "No changes to Doc/ - exiting the build."; + exit 183; + fi + - make -C Doc venv html - mkdir _readthedocs - mv Doc/build/html _readthedocs/html From b2ec93d6fa7d8ab7d38298065335c02f3e9fd5cc Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 12 May 2023 13:09:17 +0300 Subject: [PATCH 3/9] Move "then" to same line as "if" Co-authored-by: Nikita Sobolev --- .readthedocs.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 5031003ef21390..245edfec35c2f0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -20,8 +20,7 @@ build: # If there are no changes (git diff exits with 0) we force the command to return with 183. # This is a special exit code on Read the Docs that will cancel the build immediately. - | - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; - then + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; then echo "No changes to Doc/ - exiting the build."; exit 183; fi From addeef35a37c92a7a193591f71226f9df7932ca2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 12 May 2023 15:41:34 +0300 Subject: [PATCH 4/9] Double brackets --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 245edfec35c2f0..f9e5c5d12ef779 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -20,7 +20,7 @@ build: # If there are no changes (git diff exits with 0) we force the command to return with 183. # This is a special exit code on Read the Docs that will cancel the build immediately. - | - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; then + if [[ "$READTHEDOCS_VERSION_TYPE" = "external" ]] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; then echo "No changes to Doc/ - exiting the build."; exit 183; fi From de18c2f6b54d5e9a5f301d7ec8da1c442308b961 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 12 May 2023 16:22:14 +0300 Subject: [PATCH 5/9] Bracket both expressions Co-authored-by: Nikita Sobolev --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index f9e5c5d12ef779..80f120a9c6ccdb 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -20,7 +20,7 @@ build: # If there are no changes (git diff exits with 0) we force the command to return with 183. # This is a special exit code on Read the Docs that will cancel the build immediately. - | - if [[ "$READTHEDOCS_VERSION_TYPE" = "external" ]] && git diff --quiet origin/main -- Doc/ .readthedocs.yml; then + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; then echo "No changes to Doc/ - exiting the build."; exit 183; fi From a32d767a6e936f5998a66497d5f864ec2fcca69a Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 16 May 2023 08:53:13 +0300 Subject: [PATCH 6/9] Adjust YAML --- .readthedocs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 80f120a9c6ccdb..2aa4f5427f99f1 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -19,12 +19,12 @@ build: # # If there are no changes (git diff exits with 0) we force the command to return with 183. # This is a special exit code on Read the Docs that will cancel the build immediately. - - | - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; then - echo "No changes to Doc/ - exiting the build."; - exit 183; + - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; then \ + echo "No changes to Doc/ - exiting the build."; \ + exit 183; \ fi - make -C Doc venv html - mkdir _readthedocs - mv Doc/build/html _readthedocs/html + From 9d2b63c611b20438dc9c55e7e8c6d33a9a105a32 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 16 May 2023 09:11:31 +0300 Subject: [PATCH 7/9] Remove duplicate 'the' --- Doc/tools/templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index b91f8138553e62..9632ad50a51bf0 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -12,7 +12,7 @@ {%- if is_deployment_preview %}
{% trans %}This is a deploy preview created from a pull request. - For authoritative documentation, see the {% endtrans %} + For authoritative documentation, see {% endtrans %} {% trans %} the current stable release{% endtrans %}.
{%- endif %} From 689dfe6ad466f737ff0a148acf606235b9decaad Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 23 May 2023 13:16:24 -0600 Subject: [PATCH 8/9] Use | for multiline string Co-authored-by: Manuel Kaufmann --- .readthedocs.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 2aa4f5427f99f1..04924f3bc4af04 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -19,10 +19,12 @@ build: # # If there are no changes (git diff exits with 0) we force the command to return with 183. # This is a special exit code on Read the Docs that will cancel the build immediately. - - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; then \ - echo "No changes to Doc/ - exiting the build."; \ - exit 183; \ - fi + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; + then + echo "No changes to Doc/ - exiting the build."; + exit 183; + fi - make -C Doc venv html - mkdir _readthedocs From 786eee1d8db08ac9babeae278153ac431e0373ca Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 23 May 2023 22:22:11 +0300 Subject: [PATCH 9/9] Fix indent --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 04924f3bc4af04..59830c79a404e0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -24,7 +24,7 @@ build: then echo "No changes to Doc/ - exiting the build."; exit 183; - fi + fi - make -C Doc venv html - mkdir _readthedocs