@@ -79,8 +79,10 @@ To avoid saving a cache that already exists, the `cache-hit` output from a resto
7979The `cache-primary-key` output from the restore step should also be used to ensure
8080the cache key does not change during the build if it's calculated based on file contents.
8181
82+ Here's an example where we imagine we're calculating a lot of prime numbers and want to cache them :
83+
8284` ` ` yaml
83- name: Always Caching Primes
85+ name: Always Caching Prime Numbers
8486
8587on: push
8688
@@ -91,23 +93,23 @@ jobs:
9193 steps:
9294 - uses: actions/checkout@v4
9395
94- - name: Restore cached Primes
95- id: cache-primes -restore
96+ - name: Restore cached Prime Numbers
97+ id: cache-prime-numbers -restore
9698 uses: actions/cache/restore@v4
9799 with:
98- key: ${{ runner.os }}-primes
100+ key: ${{ runner.os }}-prime-numbers
99101 path: |
100102 path/to/dependencies
101103 some/other/dependencies
102104
103105 # Intermediate workflow steps
104106
105- - name: Always Save Primes
106- id: cache-primes -save
107- if: always() && steps.cache-primes -restore.outputs.cache-hit != 'true'
107+ - name: Always Save Prime Numbers
108+ id: cache-prime-numbers -save
109+ if: always() && steps.cache-prime-numbers -restore.outputs.cache-hit != 'true'
108110 uses: actions/cache/save@v4
109111 with:
110- key: ${{ steps.cache-primes -restore.outputs.cache-primary-key }}
112+ key: ${{ steps.cache-prime-numbers -restore.outputs.cache-primary-key }}
111113 path: |
112114 path/to/dependencies
113115 some/other/dependencies
0 commit comments