DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Why GitHub Actions Cache Does Not Save Again on an Exact Key Hit

GitHub Actions does not overwrite an existing cache on an exact key hit. Learn how to make dependency changes create new keys and diagnose misses, permissions, and scope.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If GitHub Actions restores a cache using the exact primary key, it reuses that existing entry rather than saving the current files over it. Cache entries are immutable. To make dependency changes produce a new cache, derive the primary key from the relevant lockfile and compatibility inputs such as the operating system; use a restore-key prefix only as a fallback, then run the package manager to reconcile dependencies.

Why a cache hit does not refresh the cache

GitHub Actions cache keys identify immutable entries. As GitHub puts it, “You cannot change the contents of an existing cache.” When a run restores an entry whose key exactly matches the primary key, actions/cache skips saving a replacement under that same key. The action’s post-job log can say: Cache hit occurred on the primary key [key], not saving cache. Here, [key] represents the actual key reported in the run. GitHub’s dependency caching documentation and the action’s save implementation describe this behavior.

As an Amazon Associate I earn from qualifying purchases.

This is expected when the key still accurately represents the cached files. It becomes a freshness problem when inputs change but the key does not—for example, when a dependency lockfile is updated while the cache key remains static. A successful run can then keep restoring the older entry because there is no new key under which to save the updated contents.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make dependency changes create a new key

For dependency caches, build the primary key from the inputs that determine whether the cached data is compatible. A lockfile hash is a common freshness trigger; include dimensions such as the operating system when they affect the contents. GitHub’s documentation demonstrates using hashFiles() so a lockfile change changes the key. See GitHub’s key and restore-key examples.

#1 Best Overall
Sale
BONTEC Mobile Standing Desk with Keyboard Tray, Mobile Podium on Wheels
  • ADJUSTABLE HEIGHT DESIGN: The mobile standing desk promotes a healthier workstyle by allowing quick transitions between sitting and standing. The gas spring lift smoothly adjusts the height from 28.3in to 44in, supporting better posture and reducing neck and back strain during long working hours. This portable desk improves daily comfort and productivity across different environments.
  • SUPERIOR STABILITY AND DURABILITY: The rolling desk adjustable height model stands out with its sturdy H shaped steel base and reinforced structure, providing stability even at maximum extension. The waterproof and scratch resistant MDF desktop ensures long lasting use, while the retractable keyboard tray and hook create organized storage for accessories. This unique design differentiates the desk from standard folding table or rolling podium options on the market.
  • ERGONOMIC AND FUNCTIONAL DESIGN: The portable standing desk offers a spacious 25.6 x 17.7in surface to accommodate a laptop, monitor, or books. A dedicated slot holds phones and tablets, while the 23.6 x 11.8in keyboard tray supports a full size keyboard and mouse. The thoughtful structure allows the small standing desk to serve as a side table, study cart, or computer desk with keyboard tray in living rooms, bedrooms, and offices.
  • EASY MOBILITY WITH LOCKABLE WHEELS: The adjustable rolling desk includes four caster wheels that allow smooth movement between rooms. The lockable function secures the desk in place when needed, creating flexibility for use as a rolling laptop desk, classroom furniture, or teacher standing desk. The compact rolling table design makes the desk on wheels easy to move, while maintaining stability during presentations or study sessions.
  • EASY OPERATION AND LOW MAINTENANCE: The sit stand desk is operated with a simple hand lever that activates the gas spring for smooth upward adjustment, while gentle pressure lowers the surface. The mobile desk workstation requires minimal maintenance, as the MDF board is waterproof, scratch resistant, and easy to clean with a damp cloth. This reliable raising desk minimizes user effort and ensures long term durability without complex upkeep.
- uses: actions/cache@v4
  id: deps
  with:
    path: <package-manager cache or dependency directory>
    key: ${{ runner.os }}-deps-${{ hashFiles('<lockfile glob>') }}
    restore-keys: |
      ${{ runner.os }}-deps-

This is a pattern, not a universal workflow. Choose a path and lockfile glob that match the project, and make sure the install step uses the same lockfile. GitHub notes that setup actions can manage caching for common ecosystems, including Node, Python, Java, Ruby, Go, and .NET. Consult the official caching reference for ecosystem-specific guidance.

What happens when the lockfile changes

  1. The changed lockfile produces a different primary key, assuming the hash pattern covers the file actually used by the install step.
  2. If the exact new key does not exist, the restore-key prefix may select an older matching cache. That is a partial restore, not an exact hit.
  3. Run the package manager so it reconciles the restored directory with the current lockfile. A cache restore alone does not update dependency state.
  4. If the job completes successfully and can write to the applicable cache scope, the action can save the resulting files under the new primary key.

The official action reports cache-hit as true for an exact match and false for a restore-key match. Do not use “some cache was restored” as a reason to skip dependency installation. The actions/cache documentation explains the input and output behavior.

Rank #2
HUANUO 32x19 Inch Small Electric Standing Desk, Adjustable, Light Walnut
  • 【32” x 19” Perfect for Small Spaces & Corner】 Specially designed with a compact 32" x 19" desktop, this small electric standing desk seamlessly fits into limited areas like apartments, bedrooms, and cozy home office corners without crowding your room. It is the ultimate space-saving, height-adjustable solution to pair with under-desk treadmills and walking pads for remote workers, freelancers, and students
  • 【4 Memory Presets & DIY Wheel Ready】 This adjustable desk features a smart control panel with 4 programmable memory presets for effortless one-touch height adjustment (28.3" to 46.5"). Plus, built-in universal M8 screw holes on the desk feet allow you to easily install your own casters/wheels to DIY it into a mobile rolling desk.
  • 【176 lbs Max Load & Rounded Safety Corners】 Constructed with heavy-duty steel rails and a solid desktop, this small stand up desk supports up to 176 lbs with exceptional stability while transitioning. The tabletop features smooth rounded corners to protect you, your family, or pets from accidental bumps in tight, compact spaces.
  • 【Rigorously Tested for Long-Lasting Use】 Engineered for daily reliability, our motor and lifting system have been rigorously tested to withstand up to 50,000 lift cycles under full capacity. Enjoy a whisper-quiet, smooth sit-to-stand transition that keeps you focused and productive all day.
  • 【Easy Assembly & Budget-Friendly Choice】 Comes with detailed instructions and all hardware included for a hassle-free, quick setup. Get premium electric sit-stand functionality at an unbeatable, budget-friendly price. Risk-free purchase with dedicated customer support ready to help.

Diagnose why a run did not save a cache

Use the restore and post-job logs to distinguish an exact hit from a miss or partial restore, then check the key, write conditions, and scope in that order.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Read the post-job message. The exact-key message, Cache hit occurred on the primary key [key], not saving cache., means the action found the primary key and did not overwrite it. A restore-key match is different; inspect the reported cache-hit output.
  2. Inspect the resolved primary key. Compare it between runs and check that it changes when the relevant lockfile changes. Verify that any hashFiles() glob includes the lockfile the install step actually uses; a static key or an ineffective glob will not provide the intended freshness trigger.
  3. If there was a miss, check whether the job could save. Automatic cache creation after a miss depends on successful job completion. Some low-trust workflows have read-only access to the default-branch cache scope; GitHub documents a warning in that case while the job continues. Use a trusted workflow to maintain a cache when appropriate rather than broadly granting untrusted jobs write access. GitHub documents cache permissions and scope rules.
  4. Check branch scope and cache version. Cache lookup depends on the key, version, and branch scope. Version metadata incorporates the cached paths and compression tooling, so changing paths or the relevant compression setup can affect compatibility. A sibling branch’s cache is not generally available. Pull-request caches use merge-ref scopes and are not generally reusable by the base branch or other pull requests. See GitHub’s documented scope rules.
  5. Check retention and repository storage if an older entry is missing. GitHub’s documentation accessed October 7, 2026 says caches not accessed for over seven days are removed. It also lists a 10 GB default total cache limit per repository; administrators may configure a higher limit, and least-recently-accessed entries are evicted after the limit is reached. The current retention and storage details are in GitHub’s documentation.

Choose a cache strategy that matches the data

Strategy Freshness behavior When it fits What to watch
Static primary key The same key continues to identify the same immutable entry. Only when the cached contents remain valid for the entire lifetime of that key. Changes to dependencies or other compatibility inputs do not create a replacement entry.
Lockfile-derived primary key A change to a covered lockfile produces a new primary key. Dependency caches whose contents should track a lockfile. Include relevant compatibility dimensions, and ensure the hash covers the lockfile used by the install step.
Lockfile-derived key with a restore-key prefix Tries the exact key first, then can restore the most recently created matching prefix entry. When an older cache is a useful starting point for the package manager. A prefix match is partial: reconcile dependencies against the current lockfile rather than treating the restore as proof they are current.

Cache contents also have a security boundary. Do not store credentials, tokens, or other secrets in a cache. GitHub warns that people able to open pull requests may be able to access cache contents, and that restoring and using untrusted cache content can create code-execution risks. Review GitHub’s security guidance before sharing caches across trust boundaries.

Rank #3
Dell Optiplex 3060 Desktop Computer | Intel i5-8500 (3.2) | 32GB DDR4 RAM | 1TB SSD Solid State | Built in WiFi | Bluetooth | Windows 11 Professional | Home or Office PC (Renewed)
  • [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
  • [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
  • [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
  • [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
  • [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What the “23 days” report does—and does not—show

The article behind the “23 days” figure reports that its author, jidonglab, encountered a stale cache of that age and saw install times change from 38 seconds to 2 minutes 51 seconds, followed by a 36-second run. Those are the author’s case-study figures, not independently verified measurements or a GitHub-wide benchmark. The incident illustrates how a key that fails to change can preserve stale contents; it does not mean every exact cache hit is stale. An exact hit is appropriate when the cache remains valid for the inputs represented by its key. Read the author’s account.

Rank #4
Sale
VIVO Black 32 in Standing Desk Converter, DESK-V000K
  • Create Instant Active Standing - VIVO’s desk riser provides on-demand standing throughout the day for the freedom to get out of your chair and relieve muscle tension, reduce stress, and increase productivity. --Patented--
  • Space Efficient 31.5" Surface - The top surface measures 31.5” x 15.7”, which maximizes space while still providing room for dual monitors. The 31.3" x 11.8" (10.5" in center) keyboard tray raises in sync with the top surface to create a comfortable workstation.
  • Strong 33 lbs Lift Assist - Go from sitting to standing in one smooth motion using the innovative simple touch height locking mechanism (Adjustment Range: 4.5" to 20"). Lift design elevates straight upwards.
  • Very Minimal Assembly - This riser is almost ready to go right out of the box! Place on your existing desk, attach the keyboard tray, and start organizing your workstation.
  • We've Got You Covered - Sturdy, high-grade steel design is backed with a 3-Year Manufacturer Warranty and friendly tech support to help with any questions or concerns.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.