mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-27 22:49:17 +01:00
Removed -2 error code
This commit is contained in:
parent
34faf3ad7c
commit
f9ae5e0028
3 changed files with 16 additions and 16 deletions
10
dist/save-only/index.js
vendored
10
dist/save-only/index.js
vendored
|
@ -41119,14 +41119,14 @@ const utils = __importStar(__webpack_require__(443));
|
||||||
process.on("uncaughtException", e => utils.logWarning(e.message));
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
||||||
function saveImpl(stateProvider) {
|
function saveImpl(stateProvider) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let cacheId;
|
let cacheId = -1;
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return -2; //-2 refers as safe to ignore for the caller
|
return;
|
||||||
}
|
}
|
||||||
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 -2;
|
return;
|
||||||
}
|
}
|
||||||
// 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 -2;
|
return;
|
||||||
}
|
}
|
||||||
// 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 -2;
|
return;
|
||||||
}
|
}
|
||||||
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
||||||
required: true
|
required: true
|
||||||
|
|
10
dist/save/index.js
vendored
10
dist/save/index.js
vendored
|
@ -41063,14 +41063,14 @@ const utils = __importStar(__webpack_require__(443));
|
||||||
process.on("uncaughtException", e => utils.logWarning(e.message));
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
||||||
function saveImpl(stateProvider) {
|
function saveImpl(stateProvider) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let cacheId;
|
let cacheId = -1;
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return -2; //-2 refers as safe to ignore for the caller
|
return;
|
||||||
}
|
}
|
||||||
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 -2;
|
return;
|
||||||
}
|
}
|
||||||
// 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 -2;
|
return;
|
||||||
}
|
}
|
||||||
// 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 -2;
|
return;
|
||||||
}
|
}
|
||||||
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
||||||
required: true
|
required: true
|
||||||
|
|
|
@ -10,11 +10,11 @@ import * as utils from "./utils/actionUtils";
|
||||||
// throw an uncaught exception. Instead of failing this action, just warn.
|
// throw an uncaught exception. Instead of failing this action, just warn.
|
||||||
process.on("uncaughtException", e => utils.logWarning(e.message));
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
||||||
|
|
||||||
async function saveImpl(stateProvider: IStateProvider): Promise<number> {
|
async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {
|
||||||
let cacheId;
|
let cacheId = -1;
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return -2; //-2 refers as safe to ignore for the caller
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 -2;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 -2;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 -2;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
||||||
|
|
Loading…
Reference in a new issue