actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.37k stars 1.16k forks source link

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

Open overheadhunter opened 7 months ago

overheadhunter commented 7 months ago

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-.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

overheadhunter commented 6 days ago

just retested this and the issue persists