mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-23 17:23:59 +08:00
Merge 3d41dc5e6b
into ac25611cae
This commit is contained in:
commit
5670691bf7
7 changed files with 136 additions and 10 deletions
1
dist/restore/index.js
vendored
1
dist/restore/index.js
vendored
|
@ -4971,6 +4971,7 @@ var Inputs;
|
|||
Inputs["Path"] = "path";
|
||||
Inputs["RestoreKeys"] = "restore-keys";
|
||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||
Inputs["UpdateEnvVariable"] = "update-env-variable";
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
|
|
25
dist/save/index.js
vendored
25
dist/save/index.js
vendored
|
@ -4971,6 +4971,7 @@ var Inputs;
|
|||
Inputs["Path"] = "path";
|
||||
Inputs["RestoreKeys"] = "restore-keys";
|
||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||
Inputs["UpdateEnvVariable"] = "update-env-variable";
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
|
@ -47326,9 +47327,27 @@ function run() {
|
|||
utils.logWarning(`Error retrieving key from state.`);
|
||||
return;
|
||||
}
|
||||
if (utils.isExactKeyMatch(primaryKey, state)) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
const envVarName = core.getInput(constants_1.Inputs.UpdateEnvVariable);
|
||||
let envVarValue;
|
||||
if (envVarName) {
|
||||
envVarValue = process.env[envVarName];
|
||||
}
|
||||
if (envVarValue !== undefined) {
|
||||
const forceUpdate = ["true", "yes"].includes(envVarValue.toLowerCase());
|
||||
if (forceUpdate) {
|
||||
core.info(`Cache saving was forced by setting "${envVarName}" to "${envVarValue}".`);
|
||||
}
|
||||
else {
|
||||
core.info(`Cache saving was disabled by setting "${envVarName}" to "${envVarValue}".`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.info(`"${envVarName}" is not set.`);
|
||||
if (utils.isExactKeyMatch(primaryKey, state)) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
||||
required: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue