Skip to content

allow replacing stale cache#163

Open
titusfortner wants to merge 1 commit into
bazel-contrib:mainfrom
titusfortner:replace_cache
Open

allow replacing stale cache#163
titusfortner wants to merge 1 commit into
bazel-contrib:mainfrom
titusfortner:replace_cache

Conversation

@titusfortner
Copy link
Copy Markdown
Contributor

Adds a new config value that deletes cache with matching prefixes before saving cache (limited to current ref).
My use case is that we only save cache from one branch, so as soon as the cache is changed we'll never need the old one, and when we are doing a lot of version bumps we're getting a lot of cache churn.

Requires actions: write permission on the workflow token. Requires cache-save: true (the default)

Separate note, if you wanted to make this work for #18 we could add a one line replacement:

  if (cacheHit === 'true') {

with

  if (cacheHit === 'true' && config.cacheReplace !== true) {

But I figured that was out of scope for my needs here.

Comment thread post.js
}

async function deleteCachesByPrefix(prefix) {
const token = process.env.BAZELISK_GITHUB_TOKEN
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to use Bazelisk env var here. Let's thread token from token input to this post action via a state variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants