setup-java icon indicating copy to clipboard operation
setup-java copied to clipboard

Cache integration between `actions/setup-java` and `actions/cache` / `actions/cache/restore`

Open caquino opened this issue 1 year ago • 1 comments

Description: Expose cache-primary-key as an output to allow integration with actions/cacheand actions/cache/restore.

Justification: Caching rules differ according to the build tool used (mvn/sbt/etc), and I would like to leverage the logic already implemented on actions/setup-java to handle the specifics for each build tool.

That being said, I have dependent jobs that I would like to guarantee that the same cache is used by forcing the same cache key.

I understand that any advanced cache usage should be done manually using actions/cache, but just exposing the cache key used by actions/setup-java as an output, like cache-hit, would make it possible to extend the functionality from actions/setup-java.

Another possibility would be for actions/setup-java not only to set an output with the cache key but also to accept an input cache-key, but I think this goes into the realm of "should be done using actions/cache".

Are you willing to submit a PR?

My understanding is that a small change here to set an output, and to action.yml to declare the output, would suffice. I would be more than happy to submit a PR, but before doing so, I would like to check with the team to see if this aligns with the vision for the future.

caquino avatar Feb 14 '24 13:02 caquino

Hello @caquino Thank you for creating this feature request. We will investigate it and get back to you as soon as we have some feedback.

HarithaVattikuti avatar Feb 15 '24 17:02 HarithaVattikuti