Skip to content

Commit b561e4d

Browse files
authored
Disable caching for pushes to main branch and consolidate caching logic (pyvista#7187)
1 parent f6683d6 commit b561e4d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

.github/workflows/docs.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,16 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
env:
24-
USE_CACHE: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.cache == 'true') || (github.event_name == 'pull_request') || (github.event_name == 'push') }}
24+
USE_CACHE: ${{
25+
(
26+
(github.event_name == 'workflow_dispatch' && github.event.inputs.cache == 'true') ||
27+
(github.event_name == 'pull_request') ||
28+
(github.event_name == 'push')
29+
) &&
30+
!startsWith(github.ref, 'refs/tags/v') &&
31+
!startsWith(github.ref, 'refs/heads/release/') &&
32+
!startsWith(github.ref, 'refs/heads/main')
33+
}}
2534
PYDEVD_DISABLE_FILE_VALIDATION: "1"
2635
PYTEST_ADDOPTS: "--color=yes"
2736
FORCE_COLOR: "True"
@@ -66,21 +75,21 @@ jobs:
6675
6776
- name: Cache Sphinx-Gallery Examples
6877
uses: actions/cache@v4
69-
if: env.USE_CACHE == 'true' && !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/tags/v') && (! github.event_name == 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'no-gallery-cache'))
78+
if: env.USE_CACHE == 'true' && (! github.event_name == 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'no-gallery-cache'))
7079
with:
7180
path: doc/source/examples/
7281
key: doc-examples-${{ hashFiles('pyvista/_version.py') }}
7382

7483
- name: Cache example data
7584
uses: actions/cache@v4
76-
if: env.USE_CACHE == 'true' && !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/tags/v') && (! github.event_name == 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'no-example-data-cache'))
85+
if: env.USE_CACHE == 'true' && (! github.event_name == 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'no-example-data-cache'))
7786
with:
7887
path: ${{ env.PYVISTA_EXAMPLE_DATA_PATH }}
7988
key: example-data-1-${{ hashFiles('pyvista/_version.py') }}
8089

8190
- name: Cache Sphinx build directory
8291
uses: actions/cache@v4
83-
if: env.USE_CACHE == 'true' && !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/tags/v') && (! github.event_name == 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'no-sphinx-build-cache'))
92+
if: env.USE_CACHE == 'true' && (! github.event_name == 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'no-sphinx-build-cache'))
8493
with:
8594
path: doc/_build/
8695
key: doc-examples-${{ hashFiles('pyvista/_version.py') }}

0 commit comments

Comments
 (0)