-
I have a few separate caches set up for my Gradle-based project but I noticed today that cache restoration seems to not happen at all. Actions says there is no cache hit when it attempts to restore it before the build, then says it can’t create the cache because it already exists. I’m not sure what’s up with this, are caches not accessible to PRs from forks? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Sure, caches is available to PRs from forks. However, there are some restrictions for accessing a cache that you need to know.
The cache created for a branch would not be accessible to its base branch and other branches which are not based on this branch. Similarly, the cache created in the forked repository would not be accessible to the original repository. If you create a cache in the forked repository, this cache is not accessible to the PR opened for merging from the forked repository into the original repository, because this PR is opened in the original repository. |
Beta Was this translation helpful? Give feedback.
-
Welp, that’d explain it. Thanks for your assistance! |
Beta Was this translation helpful? Give feedback.
-
@brightran I’ve been having the same problem. I’ve been creating a cache during my release pushes but it’s never found during future releases. According to your explanation that’s because I’m creating the cache on a release branch and not a base branch. What would the proper workflow be then? Should I run a separate GitHub Action on the master branch to cache my data and only run it again if I need to update the cache? I’m using cache@v2 btw. |
Beta Was this translation helpful? Give feedback.
@msfjarvis,
Sure, caches is available to PRs from forks. However, there are some restrictions for accessing a cache that you need to know.
According to the description below from the docs about cache:
The cache created for a branch would not be accessible to its base branch and other branches which are not based on this branch.
Similarly, the cache cre…