Skip to content

feat: Implement ability to disable adding job ID + rust environment hashes to cache names#279

Merged
Swatinem merged 18 commits intoSwatinem:masterfrom
Ryan-Brice:Ryan-Brice-patch-1
Nov 3, 2025
Merged

feat: Implement ability to disable adding job ID + rust environment hashes to cache names#279
Swatinem merged 18 commits intoSwatinem:masterfrom
Ryan-Brice:Ryan-Brice-patch-1

Conversation

@Ryan-Brice
Copy link
Contributor

@Ryan-Brice Ryan-Brice commented Oct 31, 2025

Introduce two new config options to control how cache keys are generated. These options allow users to enable or disable the inclusion of the job ID and/or hash of the Rust environment in the cache key, providing more flexibility for caching strategies.

Changes

New cache key configuration options

  • Added new optional inputs add-job-id-key and add-rust-environment-hash-key, both defaulting to "true".
    • Options allow users to control whether the job ID and/or hash of the Rust build environment are appended to the cache key.
    • Allows for the creation of cross-job and/or generic dependency caching.
  • Updated src/config.ts to work with newly added action inputs.

Related issues

Documentation updates

  • Updated README.md to document the new options, their defaults, and how they affect cache key generation.
  • Clarified the conditions under which the job ID and environment hash are included to match new options.

Workflow example

  • Added a new example workflow .github/workflows/multi-job-cache.yml.
    • Demonstrates and test the new cache key configuration options across multiple jobs and operating systems.
Related issues

Add option to include GITHUB_JOB in cache key.
Fix typo in 'use-job-key' description and required field.
Replace direct use of 'useJobKey' property with input retrieval for flexibility.
Correct description and requirement for 'use-job-key'.
- Added CacheConfig class to manage cache paths, keys, and workspace configurations.
- Implemented cache restoration logic in restore.js, including handling cache misses and mismatches.
- Developed save.js to handle cache saving, including cleaning up target directories and registry.
- Introduced utility functions in utils.js for command execution and cache provider selection.
- Created Workspace class in workspace.js to manage Rust workspace metadata and package retrieval.
…action.yml` files `runs.using` version `"node20"`

NOTE: Updating to stop `tsc` command warnings when using `typescript@5.9.3`
@Ryan-Brice Ryan-Brice changed the title feat: Implement ability to disable adding job ID + rust environment hashes to caches feat: Implement ability to disable adding job ID + rust environment hashes to cache names Nov 1, 2025
…keyFiles definition to avoid un-needed computation
@Ryan-Brice Ryan-Brice requested a review from Swatinem November 2, 2025 10:57
@Swatinem Swatinem merged commit 27f6075 into Swatinem:master Nov 3, 2025
30 of 31 checks passed
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.

2 participants