Skip to content

Commit

Permalink
Show conditional enabling of caching
Browse files Browse the repository at this point in the history
It took me a while to figure out how to use caching system on a condition, and set the relevant env vars.  Initially, I thought those env vars had to be set on the caching action itself, not on all the other actions -- this should be clarified too
  • Loading branch information
nyurik authored Oct 18, 2023
1 parent 42989ab commit 01a89c6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ Just copy and paste the following in your GitHub action:
uses: mozilla-actions/sccache-action@v0.0.3
```

### Conditionally run cache and enable it

```
- name: Run sccache-cache only on non-release runs
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: mozilla-actions/sccache-action@v0.0.3
- name: Set Rust caching env vars only on non-release runs
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
```

### Specify a given version of sccache

```
Expand Down

0 comments on commit 01a89c6

Please sign in to comment.