actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.37k stars 1.16k forks source link

Support for leveraging cache across scopes on demand #1289

Closed joseluisq closed 2 weeks ago

joseluisq commented 7 months ago

Recently I updated my workflow to make use of hashFiles('my-directory/**') because I only care about the content of a specific directory to build my Dockerfile. So if the content changes then obviously my Dockerfile should be built entirely.

But here is a common use case. If I have a PR that changed some of the files in 'my-directory' then the workflow should build my Dockerfile entirely (all fine).

In this regard, I understand the Restrictions for accessing a cache which basically states that GH Actions caches have limited scope (E.g. merge ref refs/pull/.../merge).

The problem that I have is that I use qemu to emulate certain architectures like ARM (not supported by GH Actions yet), PowerPC and others to build those Dockerfiles but they take 2 hours or more to build on a PR (sort of acceptable). However, when a PR gets merged into master it has to build again for another 2 or more hours unnecessarily even if the files in the merge never changed on the way. Obviously, this is because when running the pipeline under the master scope after the PR is merged, although the hashFiles function calculates the same hash in the master as the PR one it can't be found because of the scoped-based cache restrictions.

I believe that the current cache functionality of GH actions in general could be improved to leverage cache across scopes on demand to boost the productivity of developers.

Please, let me know your thoughts on this.

Best Jose

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 5 days since being marked as stale.