Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ Default `true`.
```
</details>

### `skip-cache-restore`

Skip restoring caches at setup time while still allowing caches to be saved in the post step.
This is useful when you want to force a clean build and publish fresh caches.

Default `false`.

<details>
<summary>Examples</summary>

#### Build fresh caches

```yaml
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
skip-cache-restore: true
```
</details>

### `disk-cache`

Enable [`disk_cache`][2] and store it on GitHub based on contents of `BUILD` files.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: Whether to save caches. Set to false for pull requests to allow restores but prevent saves.
required: false
default: "true"
skip-cache-restore:
description: Whether to skip restoring caches. Useful for creating fresh caches while still saving at the end.
required: false
default: "false"
cache-version:
description: Version of all caches
required: false
Expand Down
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as github from '@actions/github'

const bazeliskVersion = core.getInput('bazelisk-version')
const cacheSave = core.getBooleanInput('cache-save')
const skipCacheRestore = core.getBooleanInput('skip-cache-restore')
const cacheVersion = core.getInput('cache-version')
const moduleRoot = core.getInput('module-root')

Expand Down Expand Up @@ -66,6 +67,7 @@ const repositoryCacheConfig = yaml.parse(core.getInput('repository-cache'))
const repositoryCacheEnabled = repositoryCacheConfig !== false
let repositoryCacheFiles = [
`${moduleRoot}/MODULE.bazel`,
`${moduleRoot}/MODULE.bazel.lock`,
`${moduleRoot}/WORKSPACE.bazel`,
`${moduleRoot}/WORKSPACE.bzlmod`,
`${moduleRoot}/WORKSPACE`
Expand Down Expand Up @@ -142,6 +144,7 @@ export default {
baseCacheKey,
cacheSave,
cacheRestoreTimeoutMs,
skipCacheRestore,
bazeliskCache: {
enabled: core.getBooleanInput('bazelisk-cache'),
files: [`${moduleRoot}/.bazelversion`],
Expand Down
Loading
Loading