12
0
Fork 0
mirror of https://github.com/actions/cache.git synced 2026-07-02 13:19:31 +00:00

feat: Introduced restore-only flag

This commit is contained in:
Guillermo Mazzola 2026-04-01 22:12:08 +02:00
parent 55cc834586
commit ed7b7dd218
No known key found for this signature in database
GPG key ID: 6A17887FBC885E08
10 changed files with 63 additions and 5 deletions

View file

@ -94801,7 +94801,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["RestoreOnly"] = "restore-only"; // Input for cache, restore action
})(Inputs || (Inputs = {}));
var Outputs;
(function (Outputs) {

View file

@ -94801,7 +94801,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["RestoreOnly"] = "restore-only"; // Input for cache, restore action
})(Inputs || (Inputs = {}));
var constants_Outputs;
(function (Outputs) {

View file

@ -94806,7 +94806,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["RestoreOnly"] = "restore-only"; // Input for cache, restore action
})(Inputs || (Inputs = {}));
var Outputs;
(function (Outputs) {
@ -94937,6 +94938,10 @@ async function saveImpl(stateProvider) {
logWarning(`Event Validation Error: The event type ${process.env[Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
return;
}
if (getInputAsBool(Inputs.RestoreOnly)) {
info("Skipping saving cache as 'restore-only' option is set.");
return;
}
// If restore has stored a primary key in state, reuse that
// Else re-evaluate from inputs
const primaryKey = stateProvider.getState(State.CachePrimaryKey) ||

7
dist/save/index.js vendored
View file

@ -94806,7 +94806,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["RestoreOnly"] = "restore-only"; // Input for cache, restore action
})(Inputs || (Inputs = {}));
var constants_Outputs;
(function (Outputs) {
@ -94937,6 +94938,10 @@ async function saveImpl(stateProvider) {
logWarning(`Event Validation Error: The event type ${process.env[Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
return;
}
if (getInputAsBool(Inputs.RestoreOnly)) {
info("Skipping saving cache as 'restore-only' option is set.");
return;
}
// If restore has stored a primary key in state, reuse that
// Else re-evaluate from inputs
const primaryKey = stateProvider.getState(constants_State.CachePrimaryKey) ||