mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-22 08:43:55 +08:00
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:
parent
3a696372f2
commit
ffdb03bc68
8 changed files with 8110 additions and 3 deletions
1
dist/restore/index.js
vendored
1
dist/restore/index.js
vendored
|
@ -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) {
|
||||
|
|
6
dist/save/index.js
vendored
6
dist/save/index.js
vendored
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue