Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir
* `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: `false`
* `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: `false`
* `lookup-only` - If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Default: `false`
* `reeval-key` - A boolean which causes the key to be re-evaluated during the Post-Action step

#### Environment Variables

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ inputs:
save-always does not work as intended and will be removed in a future release.
A separate `actions/cache/restore` step should be used instead.
See https://github.com/actions/cache/tree/main/save#always-save-cache for more details.
reeval-key:
description: 'Re-evaluate the cache key during the post-action'
required: false
default: false
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
Expand Down
3 changes: 2 additions & 1 deletion dist/restore-only/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64911,7 +64911,8 @@ var Inputs;
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
Inputs["LookupOnly"] = "lookup-only";
Inputs["ReEvalKey"] = "reeval-key";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
Expand Down
3 changes: 2 additions & 1 deletion dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64911,7 +64911,8 @@ var Inputs;
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
Inputs["LookupOnly"] = "lookup-only";
Inputs["ReEvalKey"] = "reeval-key";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
Expand Down
8 changes: 5 additions & 3 deletions dist/save-only/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64911,7 +64911,8 @@ var Inputs;
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
Inputs["LookupOnly"] = "lookup-only";
Inputs["ReEvalKey"] = "reeval-key";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
Expand Down Expand Up @@ -64996,8 +64997,9 @@ function saveImpl(stateProvider) {
}
// If restore has stored a primary key in state, reuse that
// Else re-evaluate from inputs
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
core.getInput(constants_1.Inputs.Key);
const primaryKey = core.getBooleanInput(constants_1.Inputs.ReEvalKey)
? core.getInput(constants_1.Inputs.Key)
: (stateProvider.getState(constants_1.State.CachePrimaryKey) || core.getInput(constants_1.Inputs.Key));
if (!primaryKey) {
utils.logWarning(`Key is not specified.`);
return;
Expand Down
8 changes: 5 additions & 3 deletions dist/save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64911,7 +64911,8 @@ var Inputs;
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
Inputs["LookupOnly"] = "lookup-only";
Inputs["ReEvalKey"] = "reeval-key";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
Expand Down Expand Up @@ -64996,8 +64997,9 @@ function saveImpl(stateProvider) {
}
// If restore has stored a primary key in state, reuse that
// Else re-evaluate from inputs
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
core.getInput(constants_1.Inputs.Key);
const primaryKey = core.getBooleanInput(constants_1.Inputs.ReEvalKey)
? core.getInput(constants_1.Inputs.Key)
: (stateProvider.getState(constants_1.State.CachePrimaryKey) || core.getInput(constants_1.Inputs.Key));
if (!primaryKey) {
utils.logWarning(`Key is not specified.`);
return;
Expand Down
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export enum Inputs {
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action
LookupOnly = "lookup-only" // Input for cache, restore action
LookupOnly = "lookup-only", // Input for cache, restore action
ReEvalKey = "reeval-key"
}

export enum Outputs {
Expand Down
6 changes: 3 additions & 3 deletions src/saveImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export async function saveImpl(

// If restore has stored a primary key in state, reuse that
// Else re-evaluate from inputs
const primaryKey =
stateProvider.getState(State.CachePrimaryKey) ||
core.getInput(Inputs.Key);
const primaryKey = core.getBooleanInput(Inputs.ReEvalKey)
? core.getInput(Inputs.Key)
: (stateProvider.getState(State.CachePrimaryKey) || core.getInput(Inputs.Key));

if (!primaryKey) {
utils.logWarning(`Key is not specified.`);
Expand Down