From 0f7cef56c741e3c32d63918a7fc8bfe73e37f534 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 18:06:57 -0700 Subject: [PATCH 1/4] Improve git diff command to actually exclude non-documentation files and use globbing for `.rst` files --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index a0b0bec4..f66d9622 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -24,7 +24,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 -- docs/ src/icalender/*.py CHANGES.rst CONTRIBUTING.rst LICENSE.rst README.rst .readthedocs.yaml requirements_docs.txt; + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- . docs/ src/icalendar/*.py *.rst .readthedocs.yaml requirements_docs.txt ':!src/icalendar/fuzzing' ':!src/icalendar/tests' ':!src/icalendar/timezone'; then exit 183; fi From fc177e9af76a6693a3bb0c3d02d9c1e39a9ee126 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 18:08:50 -0700 Subject: [PATCH 2/4] Modify change log --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7499c5d1..f09f526a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -66,7 +66,7 @@ New features: - Test compatibility with Python 3.12 - Add function ``icalendar.use_pytz()``. - Add `sphinx-autobuild` for `livehtml` Makefile target. -- Add pull request preview on Read the Docs. +- Add pull request preview on Read the Docs, building only on changes to documentation-related files. Bug fixes: From ef1edce590f909c6ca764ca2194a6ca5327e2d5a Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 18:23:39 -0700 Subject: [PATCH 3/4] Add GitHub Action that adds a link in the issue description when there are changes in the docs --- .github/workflows/rtd-pr-preview.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/rtd-pr-preview.yml diff --git a/.github/workflows/rtd-pr-preview.yml b/.github/workflows/rtd-pr-preview.yml new file mode 100644 index 00000000..d840079b --- /dev/null +++ b/.github/workflows/rtd-pr-preview.yml @@ -0,0 +1,26 @@ +# .github/workflows/rtd-pr-preview.yml +name: readthedocs/actions +on: + pull_request_target: + types: + - opened + # Execute this action only on PRs that touch + # documentation files. + paths: + - "docs/**" + - "*.rst" + - "src/icalendar/*.py" + - .readthedocs.yaml + - requirements_docs.txt + +permissions: + pull-requests: write + +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: "icalendar" + single-version: "true" From 327f28bb86009df4ecb6619342c07f834def9dd0 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 18:24:55 -0700 Subject: [PATCH 4/4] Another change log --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index f09f526a..29aca8ba 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -67,6 +67,7 @@ New features: - Add function ``icalendar.use_pytz()``. - Add `sphinx-autobuild` for `livehtml` Makefile target. - Add pull request preview on Read the Docs, building only on changes to documentation-related files. +- Add link to pull request preview builds in the pull request description only when there are changes to documentation-related files. Bug fixes: