This commit is contained in:
Caleb Gosiak 2021-09-30 19:28:38 -05:00
parent 0b4a0a4930
commit 7b3fb19462
5 changed files with 28 additions and 22 deletions

16
dist/save/index.js vendored
View file

@ -2349,7 +2349,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.formatKey = exports.isGhes = void 0;
const core = __importStar(__webpack_require__(6470));
const constants_1 = __webpack_require__(1211);
function isGhes() {
@ -2357,9 +2357,13 @@ function isGhes() {
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
}
exports.isGhes = isGhes;
function formatKey(key) {
return key.replace(/[^\w\s]/gi, "-");
}
exports.formatKey = formatKey;
function isExactKeyMatch(key, cacheKey) {
return !!(cacheKey &&
cacheKey.localeCompare(key, undefined, {
formatKey(cacheKey).localeCompare(formatKey(key), undefined, {
sensitivity: "accent"
}) === 0);
}
@ -43281,6 +43285,7 @@ const aws_sdk_1 = __webpack_require__(9350);
const filesize_1 = __importDefault(__webpack_require__(7283));
const fs_1 = __importDefault(__webpack_require__(5747));
const path = __importStar(__webpack_require__(5622));
const actionUtils_1 = __webpack_require__(443);
class CacheService {
constructor(accessKeyId, secretAccessKey, region, bucket) {
this._client = new aws_sdk_1.S3({
@ -43295,7 +43300,7 @@ class CacheService {
restoreCache(paths, primaryKey, restoreKeys) {
return __awaiter(this, void 0, void 0, function* () {
restoreKeys = restoreKeys || [];
const keys = [primaryKey, ...restoreKeys].map(x => this.formatKey(x));
const keys = [primaryKey, ...restoreKeys].map(x => actionUtils_1.formatKey(x));
core.debug("Resolved Keys:");
core.debug(JSON.stringify(keys));
const compressionMethod = yield utils.getCompressionMethod();
@ -43331,7 +43336,7 @@ class CacheService {
}
saveCache(paths, key) {
return __awaiter(this, void 0, void 0, function* () {
const formattedKey = this.formatKey(key);
const formattedKey = actionUtils_1.formatKey(key);
const compressionMethod = yield utils.getCompressionMethod();
const cachePaths = yield utils.resolvePaths(paths);
core.debug("Cache Paths:");
@ -43452,9 +43457,6 @@ class CacheService {
.replace("/", "-")
.toLowerCase();
}
formatKey(key) {
return key.replace(/[^\w\s]/gi, "-");
}
}
exports.CacheService = CacheService;