mirror of
https://gitea.com/actions/cache.git
synced 2024-11-22 20:32:28 +08:00
Updated return ID to -2
This commit is contained in:
parent
1d114a8000
commit
34faf3ad7c
9
dist/save-only/index.js
vendored
9
dist/save-only/index.js
vendored
|
@ -41122,11 +41122,11 @@ function saveImpl(stateProvider) {
|
||||||
let cacheId;
|
let cacheId;
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return 0;
|
return -2; //-2 refers as safe to ignore for the caller
|
||||||
}
|
}
|
||||||
if (!utils.isValidEvent()) {
|
if (!utils.isValidEvent()) {
|
||||||
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
|
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
// If restore has stored a primary key in state, reuse that
|
// If restore has stored a primary key in state, reuse that
|
||||||
// Else re-evaluate from inputs
|
// Else re-evaluate from inputs
|
||||||
|
@ -41134,14 +41134,14 @@ function saveImpl(stateProvider) {
|
||||||
core.getInput(constants_1.Inputs.Key);
|
core.getInput(constants_1.Inputs.Key);
|
||||||
if (!primaryKey) {
|
if (!primaryKey) {
|
||||||
utils.logWarning(`Key is not specified.`);
|
utils.logWarning(`Key is not specified.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
// If matched restore key is same as primary key, then do not save cache
|
// If matched restore key is same as primary key, then do not save cache
|
||||||
// NO-OP in case of SaveOnly action
|
// NO-OP in case of SaveOnly action
|
||||||
const restoredKey = stateProvider.getCacheState();
|
const restoredKey = stateProvider.getCacheState();
|
||||||
if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
|
if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
|
||||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
||||||
required: true
|
required: true
|
||||||
|
@ -41149,6 +41149,7 @@ function saveImpl(stateProvider) {
|
||||||
cacheId = yield cache.saveCache(cachePaths, primaryKey, {
|
cacheId = yield cache.saveCache(cachePaths, primaryKey, {
|
||||||
uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
|
uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
|
||||||
});
|
});
|
||||||
|
// -1 refers to cache not saved
|
||||||
if (cacheId != -1) {
|
if (cacheId != -1) {
|
||||||
core.info(`Cache saved with key: ${primaryKey}`);
|
core.info(`Cache saved with key: ${primaryKey}`);
|
||||||
}
|
}
|
||||||
|
|
9
dist/save/index.js
vendored
9
dist/save/index.js
vendored
|
@ -41066,11 +41066,11 @@ function saveImpl(stateProvider) {
|
||||||
let cacheId;
|
let cacheId;
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return 0;
|
return -2; //-2 refers as safe to ignore for the caller
|
||||||
}
|
}
|
||||||
if (!utils.isValidEvent()) {
|
if (!utils.isValidEvent()) {
|
||||||
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
|
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
// If restore has stored a primary key in state, reuse that
|
// If restore has stored a primary key in state, reuse that
|
||||||
// Else re-evaluate from inputs
|
// Else re-evaluate from inputs
|
||||||
|
@ -41078,14 +41078,14 @@ function saveImpl(stateProvider) {
|
||||||
core.getInput(constants_1.Inputs.Key);
|
core.getInput(constants_1.Inputs.Key);
|
||||||
if (!primaryKey) {
|
if (!primaryKey) {
|
||||||
utils.logWarning(`Key is not specified.`);
|
utils.logWarning(`Key is not specified.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
// If matched restore key is same as primary key, then do not save cache
|
// If matched restore key is same as primary key, then do not save cache
|
||||||
// NO-OP in case of SaveOnly action
|
// NO-OP in case of SaveOnly action
|
||||||
const restoredKey = stateProvider.getCacheState();
|
const restoredKey = stateProvider.getCacheState();
|
||||||
if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
|
if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
|
||||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
||||||
required: true
|
required: true
|
||||||
|
@ -41093,6 +41093,7 @@ function saveImpl(stateProvider) {
|
||||||
cacheId = yield cache.saveCache(cachePaths, primaryKey, {
|
cacheId = yield cache.saveCache(cachePaths, primaryKey, {
|
||||||
uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
|
uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
|
||||||
});
|
});
|
||||||
|
// -1 refers to cache not saved
|
||||||
if (cacheId != -1) {
|
if (cacheId != -1) {
|
||||||
core.info(`Cache saved with key: ${primaryKey}`);
|
core.info(`Cache saved with key: ${primaryKey}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number> {
|
||||||
let cacheId;
|
let cacheId;
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return 0;
|
return -2; //-2 refers as safe to ignore for the caller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!utils.isValidEvent()) {
|
if (!utils.isValidEvent()) {
|
||||||
|
@ -23,7 +23,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number> {
|
||||||
process.env[Events.Key]
|
process.env[Events.Key]
|
||||||
} is not supported because it's not tied to a branch or tag ref.`
|
} is not supported because it's not tied to a branch or tag ref.`
|
||||||
);
|
);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If restore has stored a primary key in state, reuse that
|
// If restore has stored a primary key in state, reuse that
|
||||||
|
@ -34,7 +34,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number> {
|
||||||
|
|
||||||
if (!primaryKey) {
|
if (!primaryKey) {
|
||||||
utils.logWarning(`Key is not specified.`);
|
utils.logWarning(`Key is not specified.`);
|
||||||
return 0;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If matched restore key is same as primary key, then do not save cache
|
// If matched restore key is same as primary key, then do not save cache
|
||||||
|
@ -45,7 +45,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number> {
|
||||||
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 0;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
||||||
|
@ -56,6 +56,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number> {
|
||||||
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
|
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// -1 refers to cache not saved
|
||||||
if (cacheId != -1) {
|
if (cacheId != -1) {
|
||||||
core.info(`Cache saved with key: ${primaryKey}`);
|
core.info(`Cache saved with key: ${primaryKey}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user