mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-23 11:55:30 +00:00
Fixed review comments and tests
This commit is contained in:
parent
5e7f2c1182
commit
91d7bd61be
10 changed files with 76 additions and 72 deletions
12
dist/restore-only/index.js
vendored
12
dist/restore-only/index.js
vendored
|
@ -4943,7 +4943,7 @@ exports.checkBypass = checkBypass;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stateToOutputMap = exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
var Inputs;
|
||||
(function (Inputs) {
|
||||
Inputs["Key"] = "key";
|
||||
|
@ -4969,10 +4969,6 @@ var Events;
|
|||
Events["PullRequest"] = "pull_request";
|
||||
})(Events = exports.Events || (exports.Events = {}));
|
||||
exports.RefKey = "GITHUB_REF";
|
||||
exports.stateToOutputMap = new Map([
|
||||
[State.CacheMatchedKey, Outputs.CacheRestoreKey],
|
||||
[State.CachePrimaryKey, Outputs.CachePrimaryKey]
|
||||
]);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -9388,8 +9384,12 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
]);
|
||||
this.setState = (key, value) => {
|
||||
core.setOutput(constants_1.stateToOutputMap.get(key), value);
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
|
|
12
dist/restore/index.js
vendored
12
dist/restore/index.js
vendored
|
@ -4943,7 +4943,7 @@ exports.checkBypass = checkBypass;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stateToOutputMap = exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
var Inputs;
|
||||
(function (Inputs) {
|
||||
Inputs["Key"] = "key";
|
||||
|
@ -4969,10 +4969,6 @@ var Events;
|
|||
Events["PullRequest"] = "pull_request";
|
||||
})(Events = exports.Events || (exports.Events = {}));
|
||||
exports.RefKey = "GITHUB_REF";
|
||||
exports.stateToOutputMap = new Map([
|
||||
[State.CacheMatchedKey, Outputs.CacheRestoreKey],
|
||||
[State.CachePrimaryKey, Outputs.CachePrimaryKey]
|
||||
]);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -9388,8 +9384,12 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
]);
|
||||
this.setState = (key, value) => {
|
||||
core.setOutput(constants_1.stateToOutputMap.get(key), value);
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
|
|
20
dist/save-only/index.js
vendored
20
dist/save-only/index.js
vendored
|
@ -4972,7 +4972,7 @@ exports.checkBypass = checkBypass;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stateToOutputMap = exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
var Inputs;
|
||||
(function (Inputs) {
|
||||
Inputs["Key"] = "key";
|
||||
|
@ -4998,10 +4998,6 @@ var Events;
|
|||
Events["PullRequest"] = "pull_request";
|
||||
})(Events = exports.Events || (exports.Events = {}));
|
||||
exports.RefKey = "GITHUB_REF";
|
||||
exports.stateToOutputMap = new Map([
|
||||
[State.CacheMatchedKey, Outputs.CacheRestoreKey],
|
||||
[State.CachePrimaryKey, Outputs.CachePrimaryKey]
|
||||
]);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -9417,8 +9413,12 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
]);
|
||||
this.setState = (key, value) => {
|
||||
core.setOutput(constants_1.stateToOutputMap.get(key), value);
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
|
@ -41081,7 +41081,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const cache = __importStar(__webpack_require__(692));
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const constants_1 = __webpack_require__(196);
|
||||
const stateProvider_1 = __webpack_require__(309);
|
||||
const utils = __importStar(__webpack_require__(443));
|
||||
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
||||
|
@ -41102,12 +41101,7 @@ function saveImpl(stateProvider) {
|
|||
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
|
||||
core.getInput(constants_1.Inputs.Key);
|
||||
if (!primaryKey) {
|
||||
if (stateProvider instanceof stateProvider_1.StateProvider) {
|
||||
utils.logWarning(`Error retrieving key from state.`);
|
||||
}
|
||||
else {
|
||||
utils.logWarning(`Error retrieving key from input.`);
|
||||
}
|
||||
utils.logWarning(`Key is not specified.`);
|
||||
return;
|
||||
}
|
||||
// If matched restore key is same as primary key, then do not save cache
|
||||
|
|
20
dist/save/index.js
vendored
20
dist/save/index.js
vendored
|
@ -4943,7 +4943,7 @@ exports.checkBypass = checkBypass;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stateToOutputMap = exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
||||
var Inputs;
|
||||
(function (Inputs) {
|
||||
Inputs["Key"] = "key";
|
||||
|
@ -4969,10 +4969,6 @@ var Events;
|
|||
Events["PullRequest"] = "pull_request";
|
||||
})(Events = exports.Events || (exports.Events = {}));
|
||||
exports.RefKey = "GITHUB_REF";
|
||||
exports.stateToOutputMap = new Map([
|
||||
[State.CacheMatchedKey, Outputs.CacheRestoreKey],
|
||||
[State.CachePrimaryKey, Outputs.CachePrimaryKey]
|
||||
]);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -9388,8 +9384,12 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
]);
|
||||
this.setState = (key, value) => {
|
||||
core.setOutput(constants_1.stateToOutputMap.get(key), value);
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
|
@ -41052,7 +41052,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const cache = __importStar(__webpack_require__(692));
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const constants_1 = __webpack_require__(196);
|
||||
const stateProvider_1 = __webpack_require__(309);
|
||||
const utils = __importStar(__webpack_require__(443));
|
||||
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
||||
|
@ -41073,12 +41072,7 @@ function saveImpl(stateProvider) {
|
|||
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
|
||||
core.getInput(constants_1.Inputs.Key);
|
||||
if (!primaryKey) {
|
||||
if (stateProvider instanceof stateProvider_1.StateProvider) {
|
||||
utils.logWarning(`Error retrieving key from state.`);
|
||||
}
|
||||
else {
|
||||
utils.logWarning(`Error retrieving key from input.`);
|
||||
}
|
||||
utils.logWarning(`Key is not specified.`);
|
||||
return;
|
||||
}
|
||||
// If matched restore key is same as primary key, then do not save cache
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue