From 2023b0919236ce592384a31bc4ca5690f3708db0 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Thu, 16 Nov 2023 01:12:40 +0100 Subject: [PATCH] Add docs for cache-write (#38) --- .github/workflows/build.yml | 2 +- README.md | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06bb019..6478dbc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - name: Assert latest setup-pixi version is mentioned in README run: | latest_version="$(jq -r '.version' package.json)" - count_expected=9 + count_expected=10 count_actual="$(grep -c "setup-pixi@v$latest_version" README.md || true)" if [ "$count_actual" -ne "$count_expected" ]; then echo "::error file=README.md::Expected $count_expected mentions of setup-pixi@v$latest_version in README.md, but found $count_actual." diff --git a/README.md b/README.md index 1585be1..7e72cb4 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m ```yml - uses: prefix-dev/setup-pixi@v0.4.1 with: - pixi-version: v0.5.0 + pixi-version: v0.7.0 cache: true auth-host: prefix.dev auth-token: ${{ secrets.PREFIX_DEV_TOKEN }} @@ -52,6 +52,18 @@ You can specify the behavior by setting the `cache` input argument. If you need to customize your cache-key, you can use the `cache-key` input argument. This will be the prefix of the cache key. The full cache key will be `-`. +#### Only save caches on `main` + +In order to not exceed the [10 GB cache size limit](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy) as fast, you might want to restrict when the cache is saved. +This can be done by setting the `cache-write` argument. + +```yml +- uses: prefix-dev/setup-pixi@v0.4.1 + with: + cache: true + cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} +``` + ### Authentication There are currently three ways to authenticate with pixi: