feat: expose cache-primary-key output (#597) - #1088
Merged
Merged
Conversation
Expose the primary cache key computed by the caching logic as a new `cache-primary-key` action output, so workflows can compose the built-in setup-java cache key with actions/cache or actions/cache/restore across steps and dependent jobs. - src/cache.ts: set the `cache-primary-key` output in restore() - action.yml: declare the new output - README.md: document the new output - __tests__/cache.test.ts: assert the output is set - dist: rebuild Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
What
Exposes the primary cache key computed by the caching logic as a new
cache-primary-keyaction output.Closes #597.
Why
Today the action computes a primary cache key internally (
setup-java-<os>-<arch>-<packageManager>-<hash>) but never surfaces it. Users who want to compose the built-in setup-java caching withactions/cache/actions/cache/restore— e.g. to force the same key across dependent jobs — have no way to reference it. This exposes it as an output, mirroring whatactions/setup-nodeandactions/cachealready do.Changes
src/cache.ts: set thecache-primary-keyoutput inrestore()action.yml: declare the newcache-primary-keyoutputREADME.md: document the new output__tests__/cache.test.ts: assert the output is setdist/: rebuildNotes
restore(), which runs only whencache:is set).releases/v5is in a separate PR.Testing
npm test(cache suite: 32/32 passing)