feat: expose cache-primary-key output (#597) [v5 backport]#1089
Merged
Conversation
Backport of the cache-primary-key output to the v5 release line. 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 (CommonJS) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the review feedback from the main-line PR (#1088) into the v5 backport: - src/cache.ts: use the STATE_CACHE_PRIMARY_KEY constant for the output name instead of a duplicated string literal - action.yml / README.md: clarify that the output is also empty when caching is skipped (e.g. the cache service is unavailable) - dist: rebuild Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Backport of the
cache-primary-keyoutput to the v5 release line. Companion to themainPR #1088.Closes #597 for the v5 line.
Why
Exposes the primary cache key computed by the caching logic as a new
cache-primary-keyaction output, so workflows can compose the built-in setup-java cache key withactions/cache/actions/cache/restoreacross steps and dependent jobs.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/: rebuild (CommonJS — the v5 line predates the ESM migration in Migrate to ESM and upgrade dependencies #1078)Notes
Testing
npm test(cache suite: 32/32 passing)