|
|
@ -10,13 +10,13 @@ import * as utils from "./utils/actionUtils";
|
|
|
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
|
|
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
|
|
|
|
|
|
|
|
|
|
|
async function run(): Promise<void> {
|
|
|
|
async function run(): Promise<void> {
|
|
|
|
const save = ! core.getBooleanInput(Inputs.OnlyRestore);
|
|
|
|
const save = !core.getBooleanInput(Inputs.OnlyRestore);
|
|
|
|
if (save) {
|
|
|
|
if (save) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (!utils.isCacheFeatureAvailable()) {
|
|
|
|
if (!utils.isCacheFeatureAvailable()) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!utils.isValidEvent()) {
|
|
|
|
if (!utils.isValidEvent()) {
|
|
|
|
utils.logWarning(
|
|
|
|
utils.logWarning(
|
|
|
|
`Event Validation Error: The event type ${
|
|
|
|
`Event Validation Error: The event type ${
|
|
|
@ -25,27 +25,27 @@ async function run(): Promise<void> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const state = utils.getCacheState();
|
|
|
|
const state = utils.getCacheState();
|
|
|
|
|
|
|
|
|
|
|
|
// Inputs are re-evaluted before the post action, so we want the original key used for restore
|
|
|
|
// Inputs are re-evaluted before the post action, so we want the original key used for restore
|
|
|
|
const primaryKey = core.getState(State.CachePrimaryKey);
|
|
|
|
const primaryKey = core.getState(State.CachePrimaryKey);
|
|
|
|
if (!primaryKey) {
|
|
|
|
if (!primaryKey) {
|
|
|
|
utils.logWarning(`Error retrieving key from state.`);
|
|
|
|
utils.logWarning(`Error retrieving key from state.`);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (utils.isExactKeyMatch(primaryKey, state)) {
|
|
|
|
if (utils.isExactKeyMatch(primaryKey, state)) {
|
|
|
|
core.info(
|
|
|
|
core.info(
|
|
|
|
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
|
|
|
|
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
|
|
|
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await cache.saveCache(cachePaths, primaryKey, {
|
|
|
|
await cache.saveCache(cachePaths, primaryKey, {
|
|
|
|
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
|
|
|
|
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
|
|
|
|