Debug-action-cache
If you suspect specific rules are not caching, use aquery to examine how Bazel constructs the action graph 2.2.2 . bazel aquery 'mnemonic("CppCompile", //your:target)' Use code with caution.
: Caches are scoped by branch. A cache created on a feature branch is not accessible to other feature branches, but all branches can access the default branch Stack Overflow 3. Debugging Cache Misses
This is where understanding and using the debug-action-cache workflow becomes critical. This comprehensive guide covers how action caches work, why they fail, and step-by-step methods to debug cache misses and corruption. Understanding the Action Cache
Do not debug blindly. Use built-in visualizers to see what is actually stored. For instance, you can navigate directly to the repository's native management tools: Go to your repository on GitHub. Click the tab.
If using actions/cache@v3 , add the verbose input: debug-action-cache
Mastering debug-action-cache : How to Troubleshoot and Optimize GitHub Actions Caching
Mastering the debug-action-cache : How to Troubleshoot and Optimize CI/CD Cache Efficiency
If an action's input hash changes, the action key changes, leading to a cache miss and re-execution. 2. Common Causes of Action Cache Misses
Debugging often reveals that an action isn't deterministic. For example, if a compiler includes the current time in a binary, the output will change every second, rendering the cache useless. Debugging involves stripping away these non-deterministic elements to ensure that the same inputs always yield the exact same byte-for-byte output. If you suspect specific rules are not caching,
The operation of a debug-action-cache can be broken down into a few straightforward steps:
Mastering debug-action-cache : How to Troubleshoot CI/CD Caching Issues
: In your GitHub repository, go to Settings > Secrets and variables > Actions and add the following as repository secrets:
debug-action-cache is a mindset + toolset for making caching transparent. Enable verbose logging, inspect via API, and run dry-restore jobs. Once you see exactly what key is generated, what files are stored, and why a hit/miss happens, fixing cache issues becomes straightforward. A cache created on a feature branch is
An action cache does not look at filenames; it looks at content digests. The build system collects everything that influences an action: The exact byte content of code files.
This forces the cache engine to print exact compression statistics, network download speeds, and key-matching logic directly into the console. Step 2: Audit Cache Key Hashes
: If you see Cache restored... but your build is still slow, your path might be incorrect, or the files are being overwritten by your build tool. 3. Inspect and Manage Caches via UI
A specific technical bug affected users of actions/cache@v4 prior to version v4.1.0 . In these versions, when a cache lookup failed, the action would exit immediately without setting the cache-hit output variable. Consequently, subsequent steps that checked steps.cache.outputs.cache-hit would receive a null value, breaking the workflow's logic.