Support passing files to hash in repository-cache

This commit is contained in:
Alex Rodionov 2024-03-05 14:25:19 -08:00
parent 527d41d462
commit 5058960dd0
6 changed files with 60 additions and 23 deletions

19
dist/main/index.js vendored
View file

@ -52,9 +52,19 @@ if (diskCacheEnabled) {
}
}
const repositoryCacheEnabled = core.getBooleanInput('repository-cache')
const repositoryCacheConfig = core.getInput('repository-cache')
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
let repositoryCacheFiles = [
'MODULE.bazel',
'WORKSPACE.bazel',
'WORKSPACE.bzlmod',
'WORKSPACE'
]
if (repositoryCacheEnabled) {
bazelrc.push(`build --repository_cache=${bazelRepository}`)
if (repositoryCacheConfig !== 'true') {
repositoryCacheFiles = Array(repositoryCacheConfig).flat()
}
}
const googleCredentials = core.getInput('google-credentials')
@ -143,12 +153,7 @@ module.exports = {
},
repositoryCache: {
enabled: repositoryCacheEnabled,
files: [
'MODULE.bazel',
'WORKSPACE.bazel',
'WORKSPACE.bzlmod',
'WORKSPACE'
],
files: repositoryCacheFiles,
name: 'repository',
paths: [bazelRepository]
},

File diff suppressed because one or more lines are too long

19
dist/post/index.js vendored
View file

@ -52,9 +52,19 @@ if (diskCacheEnabled) {
}
}
const repositoryCacheEnabled = core.getBooleanInput('repository-cache')
const repositoryCacheConfig = core.getInput('repository-cache')
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
let repositoryCacheFiles = [
'MODULE.bazel',
'WORKSPACE.bazel',
'WORKSPACE.bzlmod',
'WORKSPACE'
]
if (repositoryCacheEnabled) {
bazelrc.push(`build --repository_cache=${bazelRepository}`)
if (repositoryCacheConfig !== 'true') {
repositoryCacheFiles = Array(repositoryCacheConfig).flat()
}
}
const googleCredentials = core.getInput('google-credentials')
@ -143,12 +153,7 @@ module.exports = {
},
repositoryCache: {
enabled: repositoryCacheEnabled,
files: [
'MODULE.bazel',
'WORKSPACE.bazel',
'WORKSPACE.bzlmod',
'WORKSPACE'
],
files: repositoryCacheFiles,
name: 'repository',
paths: [bazelRepository]
},

File diff suppressed because one or more lines are too long