mirror of
https://github.com/actions/cache.git
synced 2025-06-25 20:01:11 +02:00
Compare commits
5 Commits
v3.2.0-bet
...
tanuj077/s
Author | SHA1 | Date | |
---|---|---|---|
a8dcf7856e | |||
d463e30c26 | |||
790b78c6b6 | |||
7520a6a3a9 | |||
a5fbe79711 |
61377
dist/restore-only/index.js
vendored
Normal file
61377
dist/restore-only/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
dist/restore/index.js
vendored
3
dist/restore/index.js
vendored
@ -47582,6 +47582,8 @@ var Inputs;
|
|||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
Outputs["CacheHit"] = "cache-hit";
|
Outputs["CacheHit"] = "cache-hit";
|
||||||
|
Outputs["Key"] = "key";
|
||||||
|
Outputs["MatchedKey"] = "matched-key";
|
||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||||
var State;
|
var State;
|
||||||
(function (State) {
|
(function (State) {
|
||||||
@ -50704,6 +50706,7 @@ function restoreImpl(stateProvider) {
|
|||||||
}
|
}
|
||||||
// Store the matched cache key in states
|
// Store the matched cache key in states
|
||||||
stateProvider.setState(constants_1.State.CacheMatchedKey, cacheKey);
|
stateProvider.setState(constants_1.State.CacheMatchedKey, cacheKey);
|
||||||
|
core.debug("setState: " + constants_1.State.CacheMatchedKey + " " + cacheKey);
|
||||||
const isExactKeyMatch = utils.isExactKeyMatch(core.getInput(constants_1.Inputs.Key, { required: true }), cacheKey);
|
const isExactKeyMatch = utils.isExactKeyMatch(core.getInput(constants_1.Inputs.Key, { required: true }), cacheKey);
|
||||||
core.setOutput(constants_1.Outputs.CacheHit, isExactKeyMatch.toString());
|
core.setOutput(constants_1.Outputs.CacheHit, isExactKeyMatch.toString());
|
||||||
core.info(`Cache restored from key: ${cacheKey}`);
|
core.info(`Cache restored from key: ${cacheKey}`);
|
||||||
|
61382
dist/save-only/index.js
vendored
Normal file
61382
dist/save-only/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
dist/save/index.js
vendored
2
dist/save/index.js
vendored
@ -4975,6 +4975,8 @@ var Inputs;
|
|||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
Outputs["CacheHit"] = "cache-hit";
|
Outputs["CacheHit"] = "cache-hit";
|
||||||
|
Outputs["Key"] = "key";
|
||||||
|
Outputs["MatchedKey"] = "matched-key";
|
||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||||
var State;
|
var State;
|
||||||
(function (State) {
|
(function (State) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"description": "Cache dependencies and build outputs",
|
"description": "Cache dependencies and build outputs",
|
||||||
"main": "dist/restore/index.js",
|
"main": "dist/restore/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && ncc build -o dist/restore src/restore.ts && ncc build -o dist/save src/save.ts",
|
"build": "tsc && ncc build -o dist/restore src/restore.ts && ncc build -o dist/save src/save.ts && ncc build -o dist/restore-only src/restoreOnly.ts && ncc build -o dist/save-only src/saveOnly.ts",
|
||||||
"test": "tsc --noEmit && jest --coverage",
|
"test": "tsc --noEmit && jest --coverage",
|
||||||
"lint": "eslint **/*.ts --cache",
|
"lint": "eslint **/*.ts --cache",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
|
27
restore-only/action.yml
Normal file
27
restore-only/action.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: 'Restore Only Cache'
|
||||||
|
description: 'Restore Cache artifacts like dependencies and build outputs to improve workflow execution time'
|
||||||
|
author: 'GitHub'
|
||||||
|
inputs:
|
||||||
|
path:
|
||||||
|
description: 'The same list of files, directories, and wildcard patterns to restore cache that were used while saving it'
|
||||||
|
required: true
|
||||||
|
key:
|
||||||
|
description: 'An explicit key for restoring the cache'
|
||||||
|
required: true
|
||||||
|
restore-keys:
|
||||||
|
description: 'An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.'
|
||||||
|
required: false
|
||||||
|
outputs:
|
||||||
|
cache-hit:
|
||||||
|
description: 'A boolean value to indicate an exact match was found for the primary key'
|
||||||
|
key:
|
||||||
|
description: 'Key passed in the input to use in subsequent steps of the workflow'
|
||||||
|
matched-key:
|
||||||
|
description: 'Cache key restored'
|
||||||
|
runs:
|
||||||
|
using: 'node16'
|
||||||
|
main: '../dist/restore-only/index.js'
|
||||||
|
branding:
|
||||||
|
icon: 'archive'
|
||||||
|
color: 'gray-dark'
|
||||||
|
|
@ -14,6 +14,10 @@ inputs:
|
|||||||
outputs:
|
outputs:
|
||||||
cache-hit:
|
cache-hit:
|
||||||
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'
|
||||||
|
key:
|
||||||
|
description: 'Key passed in the input to use in subsequent steps of the workflow'
|
||||||
|
matched-key:
|
||||||
|
description: 'Cache key restored'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: '../dist/restore/index.js'
|
main: '../dist/restore/index.js'
|
||||||
|
22
save-only/action.yml
Normal file
22
save-only/action.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
name: 'Save Only Cache'
|
||||||
|
description: 'Save Cache artifacts like dependencies and build outputs to improve workflow execution time'
|
||||||
|
author: 'GitHub'
|
||||||
|
inputs:
|
||||||
|
path:
|
||||||
|
description: 'A list of files, directories, and wildcard patterns to cache'
|
||||||
|
required: true
|
||||||
|
key:
|
||||||
|
description: 'An explicit key for saving the cache'
|
||||||
|
required: true
|
||||||
|
upload-chunk-size:
|
||||||
|
description: 'The chunk size used to split up large files during upload, in bytes'
|
||||||
|
required: false
|
||||||
|
matched-key:
|
||||||
|
description: 'Cache key restored from the restore action'
|
||||||
|
required: false
|
||||||
|
runs:
|
||||||
|
using: 'node16'
|
||||||
|
main: '../dist/save-only/index.js'
|
||||||
|
branding:
|
||||||
|
icon: 'archive'
|
||||||
|
color: 'gray-dark'
|
@ -11,6 +11,9 @@ inputs:
|
|||||||
upload-chunk-size:
|
upload-chunk-size:
|
||||||
description: 'The chunk size used to split up large files during upload, in bytes'
|
description: 'The chunk size used to split up large files during upload, in bytes'
|
||||||
required: false
|
required: false
|
||||||
|
matched-key:
|
||||||
|
description: 'Cache key restored from the restore action'
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: '../dist/save/index.js'
|
main: '../dist/save/index.js'
|
||||||
|
@ -6,7 +6,9 @@ export enum Inputs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum Outputs {
|
export enum Outputs {
|
||||||
CacheHit = "cache-hit"
|
CacheHit = "cache-hit",
|
||||||
|
Key = "key",
|
||||||
|
MatchedKey = "matched-key"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum State {
|
export enum State {
|
||||||
|
@ -5,7 +5,9 @@ import { Events, Inputs, Outputs, State } from "./constants";
|
|||||||
import { IStateProvider } from "./stateProvider";
|
import { IStateProvider } from "./stateProvider";
|
||||||
import * as utils from "./utils/actionUtils";
|
import * as utils from "./utils/actionUtils";
|
||||||
|
|
||||||
async function restoreImpl(stateProvider: IStateProvider): Promise<string | undefined> {
|
async function restoreImpl(
|
||||||
|
stateProvider: IStateProvider
|
||||||
|
): Promise<string | undefined> {
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
utils.setCacheHitOutput(false);
|
utils.setCacheHitOutput(false);
|
||||||
@ -49,6 +51,7 @@ async function restoreImpl(stateProvider: IStateProvider): Promise<string | unde
|
|||||||
|
|
||||||
// Store the matched cache key in states
|
// Store the matched cache key in states
|
||||||
stateProvider.setState(State.CacheMatchedKey, cacheKey);
|
stateProvider.setState(State.CacheMatchedKey, cacheKey);
|
||||||
|
core.debug("setState: " + State.CacheMatchedKey + " " + cacheKey);
|
||||||
|
|
||||||
const isExactKeyMatch = utils.isExactKeyMatch(
|
const isExactKeyMatch = utils.isExactKeyMatch(
|
||||||
core.getInput(Inputs.Key, { required: true }),
|
core.getInput(Inputs.Key, { required: true }),
|
||||||
|
Reference in New Issue
Block a user