sbt / sbt/sbt-github-actions

Support customizing keys of default caches

Open
#13 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
199
Forks
67
Avg merge
6h 24m
Merged PRs (30d)
3

Description

Hi!

Sometimes you want to drop the cache without necessarily changing the paths it depends on, so just a "drop cache" button would be nice to have. Sadly, actions/cache doesn't have that ability (actions/cache#2), so we need a workaround.

I used this to work around, but maybe it's something that could be a key? (e.g. the cacheOffset value):


//Increment this every time you want to drop the caches
val cacheOffset = 1

ThisBuild / githubWorkflowGeneratedCacheSteps ~= { steps =>
  steps.map {
    case u @ WorkflowStep.Use("actions", "cache", _, params, _, _, _, _) =>
      u.copy(params = params.map {
        case (k @ "key", cacheKey) => (k, s"$cacheKey-v$cacheOffset")
        case (k, v)                => (k, v)
      })
    case x                                                               => x
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the githubWorkflowGeneratedCacheSteps setting and the generated actions/cache steps referenced in the issue. Determine how a configurable cache-key value should be exposed while preserving the default behavior; done means users can change cache keys to invalidate caches without changing dependency paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.