mirror of
https://github.com/actions/cache.git
synced 2025-04-21 11:36:45 +00:00
Save-only warning added
This commit is contained in:
parent
8955114d15
commit
1d114a8000
6 changed files with 85 additions and 19 deletions
12
dist/save/index.js
vendored
12
dist/save/index.js
vendored
|
@ -41063,13 +41063,14 @@ const utils = __importStar(__webpack_require__(443));
|
|||
process.on("uncaughtException", e => utils.logWarning(e.message));
|
||||
function saveImpl(stateProvider) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let cacheId;
|
||||
try {
|
||||
if (!utils.isCacheFeatureAvailable()) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
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.`);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
// If restore has stored a primary key in state, reuse that
|
||||
// Else re-evaluate from inputs
|
||||
|
@ -41077,19 +41078,19 @@ function saveImpl(stateProvider) {
|
|||
core.getInput(constants_1.Inputs.Key);
|
||||
if (!primaryKey) {
|
||||
utils.logWarning(`Key is not specified.`);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
// If matched restore key is same as primary key, then do not save cache
|
||||
// NO-OP in case of SaveOnly action
|
||||
const restoredKey = stateProvider.getCacheState();
|
||||
if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
||||
required: true
|
||||
});
|
||||
const cacheId = yield cache.saveCache(cachePaths, primaryKey, {
|
||||
cacheId = yield cache.saveCache(cachePaths, primaryKey, {
|
||||
uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
|
||||
});
|
||||
if (cacheId != -1) {
|
||||
|
@ -41099,6 +41100,7 @@ function saveImpl(stateProvider) {
|
|||
catch (error) {
|
||||
utils.logWarning(error.message);
|
||||
}
|
||||
return cacheId;
|
||||
});
|
||||
}
|
||||
exports.default = saveImpl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue