Update README.md

pull/1766/head
Boris Staal 3 years ago
parent 8e66c851bc
commit 17f25c101a
No known key found for this signature in database

@ -188,12 +188,16 @@ A cache key can include any of the contexts, functions, literals, and operators
For example, using the [`hashFiles`](https://docs.github.com/en/actions/learn-github-actions/expressions#hashfiles) function allows you to create a new cache when dependencies change. For example, using the [`hashFiles`](https://docs.github.com/en/actions/learn-github-actions/expressions#hashfiles) function allows you to create a new cache when dependencies change.
```yaml ```yaml
- uses: actions/cache@v3 - uses: justvanilla/shared-gha-cache@s3
with: with:
path: | path: |
path/to/dependencies path/to/dependencies
some/other/dependencies some/other/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
aws-region: ${{ secrets.CACHE_AWS_REGION }}
aws-bucket: ${{ secrets.CACHE_AWS_BUCKET }}
aws-access-key-id: ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
``` ```
Additionally, you can use arbitrary command output in a cache key, such as a date or software version: Additionally, you can use arbitrary command output in a cache key, such as a date or software version:
@ -206,17 +210,21 @@ Additionally, you can use arbitrary command output in a cache key, such as a dat
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash shell: bash
- uses: actions/cache@v3 - uses: justvanilla/shared-gha-cache@s3
with: with:
path: path/to/dependencies path: path/to/dependencies
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }}
aws-region: ${{ secrets.CACHE_AWS_REGION }}
aws-bucket: ${{ secrets.CACHE_AWS_BUCKET }}
aws-access-key-id: ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
``` ```
See [Using contexts to create cache keys](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#using-contexts-to-create-cache-keys) See [Using contexts to create cache keys](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#using-contexts-to-create-cache-keys)
## Cache Limits ## Cache Limits
A repository can have up to 10GB of caches. Once the 10GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted. Since the data is stored to AWS bucket of your own management, you are the kin
## Skipping steps based on cache-hit ## Skipping steps based on cache-hit
@ -228,7 +236,7 @@ Example:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/cache@v3 - uses: justvanilla/shared-gha-cache@s3
id: cache id: cache
with: with:
path: path/to/dependencies path: path/to/dependencies
@ -260,7 +268,7 @@ jobs:
- name: Cache Primes - name: Cache Primes
id: cache-primes id: cache-primes
uses: actions/cache@v3 uses: justvanilla/shared-gha-cache@s3
with: with:
path: prime-numbers path: prime-numbers
key: primes key: primes
@ -271,7 +279,7 @@ jobs:
- name: Cache Numbers - name: Cache Numbers
id: cache-numbers id: cache-numbers
uses: actions/cache@v3 uses: justvanilla/shared-gha-cache@s3
with: with:
path: numbers path: numbers
key: primes key: primes
@ -287,7 +295,7 @@ jobs:
- name: Cache Primes - name: Cache Primes
id: cache-primes id: cache-primes
uses: actions/cache@v3 uses: justvanilla/shared-gha-cache@s3
with: with:
path: prime-numbers path: prime-numbers
key: primes key: primes

Loading…
Cancel
Save