Add skip-save feature

The skip-save option allows users to force the cache to skip saving the cache.  skip-save can be set to a constant or to an expression that will be evaluated at the end of the CI job, such as an environment variable.

This is for #498
This commit is contained in:
eyal0 2021-04-21 21:33:20 -06:00
parent 3a696372f2
commit ffdb03bc68
8 changed files with 8110 additions and 3 deletions

6
dist/save/index.js vendored
View file

@ -5469,6 +5469,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["SkipSave"] = "skip-save";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
@ -47172,6 +47173,11 @@ function run() {
utils.logWarning(`Error retrieving key from state.`);
return;
}
const skipSave = ["true", "yes"].includes(core.getInput(constants_1.Inputs.SkipSave).toLowerCase());
if (skipSave) {
core.info(`Cache saving was disabled by setting skip-save.`);
return;
}
if (utils.isExactKeyMatch(primaryKey, state)) {
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
return;