cache
cache copied to clipboard
Cache not caching on pull_request
Hi guys! How it's going? Hope you are doing well :)
Simply that, I test all the scenarios and I found that cache is caching only on push :/
Can you provide more details? Maybe a code snippet?
You may find your answer in here: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
A workflow can access and restore a cache created in the current branch, the base branch (including base branches of forked repositories), or the default branch (usually main). For example, a cache created on the default branch would be accessible from any pull request.
Access restrictions provide cache isolation and security by creating a logical boundary between different branches. For example, a cache created for the branch feature-a (with the base main) would not be accessible to a pull request for the branch feature-b (with the base main).
@andrmoel thank you! So what do you think its a good approach for caching and save minutes on pull requests ci?
Now we cache on push to development branch but it takes a bit more than a minute to complete the cache when hits a preexistent cache :/
@ManuLpz4 a cache created on the default branch would be accessible from any pull request. What problems were you facing? Are you using a different branch other than the default branch against which PRs are raised? Can you put in more details?
Hello !
I think I've just hit the same issue, we run self-hosted runners, and I wanted to cache things between sequential jobs on a PR workflow (store the scan result, then use the result to process it later)
It seems that every time I tried storing/pulling the cache, I ended with Cache not found for input keys
Seems that the only viable solution is artifact upload/download ? There might be a shared filesystem alternative
Not allowing cache across PR branches is by design to not allow cache poisoning by a malicious PR. You can still use cache from base branch (or even the default branch) in the pull request branches.