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" 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 diff --git a/CHANGES.rst b/CHANGES.rst index f5a4222c..bb5ee620 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -66,6 +66,8 @@ 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, 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. - Add documentation of live HTML preview of documentation and clean up of ``install.rst``. Bug fixes: