docs: only trigger doc pages rebuild when modifying the doc folder

This commit is contained in:
alfrix 2024-03-18 08:41:56 -03:00
parent 48b374c73e
commit daed9a098b
2 changed files with 18 additions and 5 deletions

View File

@ -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

View File

@ -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