Add disk-cache-files input to support multiple modules
Fixes #67 Add support for overriding disk cache files for multiple modules in the repository. * Add a new input `disk-cache-files` in `action.yml` to specify custom disk cache files. * Update `config.js` to handle the new `disk-cache-files` input and override the `diskCache.files` array if provided. * Update the documentation in `README.md` to include the new `disk-cache-files` input and provide examples of its usage. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/bazel-contrib/setup-bazel/issues/67?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
parent
98248079ae
commit
3f6bfb33d0
3 changed files with 35 additions and 2 deletions
21
README.md
21
README.md
|
|
@ -111,6 +111,27 @@ Default `false`.
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### `disk-cache-files`
|
||||||
|
|
||||||
|
Specify custom disk cache files.
|
||||||
|
|
||||||
|
Default `""`.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
#### Override disk cache files
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: bazel-contrib/setup-bazel@0.13.0
|
||||||
|
with:
|
||||||
|
disk-cache-files: |
|
||||||
|
**/BUILD.bazel
|
||||||
|
**/BUILD
|
||||||
|
custom/path/BUILD
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
### `external-cache`
|
### `external-cache`
|
||||||
|
|
||||||
Cache `external/` repositories based on contents of `MODULE.bazel` and `WORKSPACE` files.
|
Cache `external/` repositories based on contents of `MODULE.bazel` and `WORKSPACE` files.
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ inputs:
|
||||||
description: Cache actions outputs based on BUILD
|
description: Cache actions outputs based on BUILD
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
disk-cache-files:
|
||||||
|
description: Custom disk cache files
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
external-cache:
|
external-cache:
|
||||||
description: Cache external 10MB+ repositories based on MODULE.bazel/WORKSPACE
|
description: Cache external 10MB+ repositories based on MODULE.bazel/WORKSPACE
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
12
config.js
12
config.js
|
|
@ -53,6 +53,15 @@ if (diskCacheEnabled) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const diskCacheFilesConfig = core.getMultilineInput('disk-cache-files')
|
||||||
|
let diskCacheFiles = [
|
||||||
|
'**/BUILD.bazel',
|
||||||
|
'**/BUILD'
|
||||||
|
]
|
||||||
|
if (diskCacheFilesConfig.length > 0) {
|
||||||
|
diskCacheFiles = diskCacheFilesConfig
|
||||||
|
}
|
||||||
|
|
||||||
const repositoryCacheConfig = core.getInput('repository-cache')
|
const repositoryCacheConfig = core.getInput('repository-cache')
|
||||||
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
|
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
|
||||||
let repositoryCacheFiles = [
|
let repositoryCacheFiles = [
|
||||||
|
|
@ -140,8 +149,7 @@ module.exports = {
|
||||||
enabled: diskCacheEnabled,
|
enabled: diskCacheEnabled,
|
||||||
files: [
|
files: [
|
||||||
...repositoryCacheFiles,
|
...repositoryCacheFiles,
|
||||||
'**/BUILD.bazel',
|
...diskCacheFiles
|
||||||
'**/BUILD'
|
|
||||||
],
|
],
|
||||||
name: diskCacheName,
|
name: diskCacheName,
|
||||||
paths: [bazelDisk]
|
paths: [bazelDisk]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue