actions / actions/cache

Debug logs show hashFiles generates a hash; hash gets truncated when actually saving

Open
#1,661 1 comment 0 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

I am trying to cache a file with the following step:

      - name: Cache machine stats
        id: cache-stats
        uses: actions/cache@v4
        with:
          path: ${{ github.workspace }}/data/stats.json
          key: hist-stats-${{ hashFiles('**/data/stats.json') }}

I already ran the checkout action, the file exists, and when I run the action with the debug option on, the logs show that the file name should be: hist-stats-b97af91963eaed082bd76ddcb2e2eb7dd314fc74b1a09bc908365a0053c00b5d. However, when the cache is finally uploaded, it says Cache saved with key: hist-stats- (no hash), and when I check the caches, only hist-stats- appears. I can't for the life of me figure out why this would be and would appreciate any pointers.

You can see the PR/code that is triggering the action here: https://github.com/ufs-community/ufs-weather-model/pull/2924

I'm sorry if the issue is due to something obvious--I'm rather new to this, and I'm not seeing anything online that helps/applies to my situation.

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 workflow step in the issue body and compare the debug log's generated key with the cache upload message. Review the linked PR #2924 and the provided GitHub Actions run to trace where the hash is lost. Done means the cause is identified and a regression check or documented reproduction confirms the saved cache key includes the expected hash.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.