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:
Alex Rodionov 2025-02-18 16:26:58 -08:00
parent 98248079ae
commit 3f6bfb33d0
3 changed files with 35 additions and 2 deletions

View file

@ -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 repositoryCacheEnabled = repositoryCacheConfig !== 'false'
let repositoryCacheFiles = [
@ -140,8 +149,7 @@ module.exports = {
enabled: diskCacheEnabled,
files: [
...repositoryCacheFiles,
'**/BUILD.bazel',
'**/BUILD'
...diskCacheFiles
],
name: diskCacheName,
paths: [bazelDisk]