actions / actions/cache

Cache miss for restore-keys: `setup-java-...`

Open
#1,294 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

It is my understanding, that actions/setup-java uses the same caching mechanism as actions/cache. However I fail to restore my ~/.m2/repository from cache created by setup-java.

Workflow 1

My first workflow run uses the following config to cache my ~/.m2/repository:

  - name: Setup Java
    uses: actions/setup-java@v4
    with:
      distribution: 'temurin'
      java-version: 21
      cache: 'maven'
Workflow 2

But a consecutive run of a workflow (on the same repo) leads to a cache miss with the following config:

  - name: Cache Maven Repository
    uses: actions/cache@v3
    with:
      path: ~/.m2/repository
      key: dependency-check-${{ hashFiles('**/pom.xml') }}
      restore-keys: |
        setup-java-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
        setup-java-${{ runner.os }}-maven-

Cache not found for input keys: dependency-check-c4ff49b329ba24e6b9da26450d2b793e3d91853c334abd09f9ba075ef65fceff, setup-java-Linux-maven-c4ff49b329ba24e6b9da26450d2b793e3d91853c334abd09f9ba075ef65fceff, setup-java-Linux-maven-.

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 with the two workflow configurations in the report and compare the cache key produced by setup-java with actions/cache restore-key matching. Reproduce the consecutive-run cache miss, then determine whether the behavior is expected or a compatibility bug. Done means the behavior is fixed or clearly documented, with verification of the reported key patterns.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
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.