Merge remote-tracking branch 'origin/700-actionscache-granular-cache-control' into kotewar/readme-updates-for-granular-control

This commit is contained in:
Sankalp Kotewar 2022-12-14 10:19:50 +00:00 committed by GitHub
commit 8031e403b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 14 deletions

View File

@ -132,7 +132,7 @@ test("restore with cache found for key", async () => {
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledWith("cache-hit", "true"); expect(outputMock).toHaveBeenCalledWith("cache-hit", "true");
expect(outputMock).toHaveBeenCalledWith("cache-restore-key", key); expect(outputMock).toHaveBeenCalledWith("cache-matched-key", key);
expect(outputMock).toHaveBeenCalledTimes(3); expect(outputMock).toHaveBeenCalledTimes(3);
@ -166,7 +166,7 @@ test("restore with cache found for restore key", async () => {
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledWith("cache-hit", "false"); expect(outputMock).toHaveBeenCalledWith("cache-hit", "false");
expect(outputMock).toHaveBeenCalledWith("cache-restore-key", restoreKey); expect(outputMock).toHaveBeenCalledWith("cache-matched-key", restoreKey);
expect(outputMock).toHaveBeenCalledTimes(3); expect(outputMock).toHaveBeenCalledTimes(3);

View File

@ -4957,7 +4957,7 @@ var Outputs;
(function (Outputs) { (function (Outputs) {
Outputs["CacheHit"] = "cache-hit"; Outputs["CacheHit"] = "cache-hit";
Outputs["CachePrimaryKey"] = "cache-primary-key"; Outputs["CachePrimaryKey"] = "cache-primary-key";
Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action
})(Outputs = exports.Outputs || (exports.Outputs = {})); })(Outputs = exports.Outputs || (exports.Outputs = {}));
var State; var State;
(function (State) { (function (State) {
@ -9387,7 +9387,7 @@ class NullStateProvider extends StateProviderBase {
constructor() { constructor() {
super(...arguments); super(...arguments);
this.stateToOutputMap = new Map([ this.stateToOutputMap = new Map([
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
]); ]);
this.setState = (key, value) => { this.setState = (key, value) => {

View File

@ -4957,7 +4957,7 @@ var Outputs;
(function (Outputs) { (function (Outputs) {
Outputs["CacheHit"] = "cache-hit"; Outputs["CacheHit"] = "cache-hit";
Outputs["CachePrimaryKey"] = "cache-primary-key"; Outputs["CachePrimaryKey"] = "cache-primary-key";
Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action
})(Outputs = exports.Outputs || (exports.Outputs = {})); })(Outputs = exports.Outputs || (exports.Outputs = {}));
var State; var State;
(function (State) { (function (State) {
@ -9387,7 +9387,7 @@ class NullStateProvider extends StateProviderBase {
constructor() { constructor() {
super(...arguments); super(...arguments);
this.stateToOutputMap = new Map([ this.stateToOutputMap = new Map([
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
]); ]);
this.setState = (key, value) => { this.setState = (key, value) => {

View File

@ -4986,7 +4986,7 @@ var Outputs;
(function (Outputs) { (function (Outputs) {
Outputs["CacheHit"] = "cache-hit"; Outputs["CacheHit"] = "cache-hit";
Outputs["CachePrimaryKey"] = "cache-primary-key"; Outputs["CachePrimaryKey"] = "cache-primary-key";
Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action
})(Outputs = exports.Outputs || (exports.Outputs = {})); })(Outputs = exports.Outputs || (exports.Outputs = {}));
var State; var State;
(function (State) { (function (State) {
@ -9416,7 +9416,7 @@ class NullStateProvider extends StateProviderBase {
constructor() { constructor() {
super(...arguments); super(...arguments);
this.stateToOutputMap = new Map([ this.stateToOutputMap = new Map([
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
]); ]);
this.setState = (key, value) => { this.setState = (key, value) => {

4
dist/save/index.js vendored
View File

@ -4957,7 +4957,7 @@ var Outputs;
(function (Outputs) { (function (Outputs) {
Outputs["CacheHit"] = "cache-hit"; Outputs["CacheHit"] = "cache-hit";
Outputs["CachePrimaryKey"] = "cache-primary-key"; Outputs["CachePrimaryKey"] = "cache-primary-key";
Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action
})(Outputs = exports.Outputs || (exports.Outputs = {})); })(Outputs = exports.Outputs || (exports.Outputs = {}));
var State; var State;
(function (State) { (function (State) {
@ -9387,7 +9387,7 @@ class NullStateProvider extends StateProviderBase {
constructor() { constructor() {
super(...arguments); super(...arguments);
this.stateToOutputMap = new Map([ this.stateToOutputMap = new Map([
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
]); ]);
this.setState = (key, value) => { this.setState = (key, value) => {

View File

@ -16,8 +16,8 @@ outputs:
description: 'A boolean value to indicate an exact match was found for the primary key' description: 'A boolean value to indicate an exact match was found for the primary key'
cache-primary-key: cache-primary-key:
description: 'A resolved cache key for which cache match was attempted' description: 'A resolved cache key for which cache match was attempted'
cache-restore-key: cache-matched-key:
description: 'Restore key which was used to restore the cache. It will not be set in case there was an exact match with primary key itself' description: 'Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys'
runs: runs:
using: 'node16' using: 'node16'
main: '../dist/restore-only/index.js' main: '../dist/restore-only/index.js'

View File

@ -8,7 +8,7 @@ export enum Inputs {
export enum Outputs { export enum Outputs {
CacheHit = "cache-hit", // Output from cache, restore action CacheHit = "cache-hit", // Output from cache, restore action
CachePrimaryKey = "cache-primary-key", // Output from restore action CachePrimaryKey = "cache-primary-key", // Output from restore action
CacheRestoreKey = "cache-restore-key" // Output from restore action CacheMatchedKey = "cache-matched-key" // Output from restore action
} }
export enum State { export enum State {

View File

@ -34,7 +34,7 @@ export class StateProvider extends StateProviderBase {
export class NullStateProvider extends StateProviderBase { export class NullStateProvider extends StateProviderBase {
stateToOutputMap = new Map<string, string>([ stateToOutputMap = new Map<string, string>([
[State.CacheMatchedKey, Outputs.CacheRestoreKey], [State.CacheMatchedKey, Outputs.CacheMatchedKey],
[State.CachePrimaryKey, Outputs.CachePrimaryKey] [State.CachePrimaryKey, Outputs.CachePrimaryKey]
]); ]);