Skip to content

feat: expose cache-primary-key output (#597) [v5 backport]#1089

Merged
brunoborges merged 2 commits into
releases/v5from
brunoborges-backport-597-v5
Jul 8, 2026
Merged

feat: expose cache-primary-key output (#597) [v5 backport]#1089
brunoborges merged 2 commits into
releases/v5from
brunoborges-backport-597-v5

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

What

Backport of the cache-primary-key output to the v5 release line. Companion to the main PR #1088.

Closes #597 for the v5 line.

Why

Exposes 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 / actions/cache/restore across steps and dependent jobs.

Changes

  • src/cache.ts: set the cache-primary-key output in restore()
  • action.yml: declare the new cache-primary-key output
  • README.md: document the new output
  • __tests__/cache.test.ts: assert the output is set
  • dist/: rebuild (CommonJS — the v5 line predates the ESM migration in Migrate to ESM and upgrade dependencies #1078)

Notes

  • Non-breaking, purely additive.
  • Authored against the v5 CommonJS / jest-29 test style (this line intentionally does not include the ESM migration Migrate to ESM and upgrade dependencies #1078).
  • Empty when caching is not enabled.

Testing

  • npm test (cache suite: 32/32 passing)
  • lint + format-check clean

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>
@brunoborges brunoborges requested a review from a team as a code owner July 8, 2026 18:59
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>
@brunoborges brunoborges merged commit 513edc4 into releases/v5 Jul 8, 2026
403 checks passed
@brunoborges brunoborges deleted the brunoborges-backport-597-v5 branch July 8, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant