From daed9a098bef760c772127bf28a4f73e6f85a932 Mon Sep 17 00:00:00 2001 From: alfrix Date: Mon, 18 Mar 2024 08:41:56 -0300 Subject: [PATCH] docs: only trigger doc pages rebuild when modifying the doc folder --- .github/workflows/docs.yml | 10 +++++----- .readthedocs.yaml | 13 +++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index efa28a18..ce785404 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,9 +1,9 @@ name: docs on: push: - branches: - - master - - main + branches: [master, main] + paths: + - 'docs/**' permissions: contents: write jobs: @@ -18,12 +18,12 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - uses: actions/cache@v3 with: key: mkdocs-material-${{ env.cache_id }} path: .cache restore-keys: | mkdocs-material- - - run: pip install mkdocs-material + - run: pip install mkdocs-material - run: mkdocs gh-deploy --force diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 160cec3e..81502e94 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,6 +7,19 @@ build: os: ubuntu-lts-latest tools: python: latest + jobs: + post_checkout: + # Cancel building pull requests when there aren't changed in the docs directory or YAML file. + # You can add any other files or directories that you'd like here as well, + # like your docs requirements file, or other files that will change your docs 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/ .readthedocs.yaml; + then + exit 183; + fi mkdocs: configuration: mkdocs.yml # Optionally declare the Python requirements required to build your docs