mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-22 19:35:32 +00:00
stateinputprovider with pending test cases fix
This commit is contained in:
parent
365406cb70
commit
5b7eeecaeb
9 changed files with 53 additions and 28 deletions
8
dist/restore-only/index.js
vendored
8
dist/restore-only/index.js
vendored
|
@ -9405,6 +9405,9 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToInputMap = new Map([
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Inputs.Key]
|
||||
]);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
|
@ -9412,8 +9415,9 @@ class NullStateProvider extends StateProviderBase {
|
|||
this.setState = (key, value) => {
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
this.getState = (key) => {
|
||||
return core.getInput(this.stateToInputMap.get(key));
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.NullStateProvider = NullStateProvider;
|
||||
|
|
8
dist/restore/index.js
vendored
8
dist/restore/index.js
vendored
|
@ -9405,6 +9405,9 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToInputMap = new Map([
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Inputs.Key]
|
||||
]);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
|
@ -9412,8 +9415,9 @@ class NullStateProvider extends StateProviderBase {
|
|||
this.setState = (key, value) => {
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
this.getState = (key) => {
|
||||
return core.getInput(this.stateToInputMap.get(key));
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.NullStateProvider = NullStateProvider;
|
||||
|
|
11
dist/save-only/index.js
vendored
11
dist/save-only/index.js
vendored
|
@ -9461,6 +9461,9 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToInputMap = new Map([
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Inputs.Key]
|
||||
]);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
|
@ -9468,8 +9471,9 @@ class NullStateProvider extends StateProviderBase {
|
|||
this.setState = (key, value) => {
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
this.getState = (key) => {
|
||||
return core.getInput(this.stateToInputMap.get(key));
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.NullStateProvider = NullStateProvider;
|
||||
|
@ -41059,8 +41063,7 @@ function saveImpl(stateProvider) {
|
|||
}
|
||||
// If restore has stored a primary key in state, reuse that
|
||||
// Else re-evaluate from inputs
|
||||
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
|
||||
core.getInput(constants_1.Inputs.Key);
|
||||
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey);
|
||||
if (!primaryKey) {
|
||||
utils.logWarning(`Key is not specified.`);
|
||||
return;
|
||||
|
|
11
dist/save/index.js
vendored
11
dist/save/index.js
vendored
|
@ -9405,6 +9405,9 @@ exports.StateProvider = StateProvider;
|
|||
class NullStateProvider extends StateProviderBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stateToInputMap = new Map([
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Inputs.Key]
|
||||
]);
|
||||
this.stateToOutputMap = new Map([
|
||||
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
|
||||
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
||||
|
@ -9412,8 +9415,9 @@ class NullStateProvider extends StateProviderBase {
|
|||
this.setState = (key, value) => {
|
||||
core.setOutput(this.stateToOutputMap.get(key), value);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
this.getState = (key) => "";
|
||||
this.getState = (key) => {
|
||||
return core.getInput(this.stateToInputMap.get(key));
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.NullStateProvider = NullStateProvider;
|
||||
|
@ -41003,8 +41007,7 @@ function saveImpl(stateProvider) {
|
|||
}
|
||||
// If restore has stored a primary key in state, reuse that
|
||||
// Else re-evaluate from inputs
|
||||
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
|
||||
core.getInput(constants_1.Inputs.Key);
|
||||
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey);
|
||||
if (!primaryKey) {
|
||||
utils.logWarning(`Key is not specified.`);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue