1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-05-02 16:29:54 +02:00

Include keys in getCacheEntry request

This commit is contained in:
Ethan Dennis 2020-03-16 12:49:13 -07:00
parent bd756c16ae
commit 072d513f28
No known key found for this signature in database
GPG key ID: 32E74B75DB4065DD
6 changed files with 19 additions and 37 deletions

View file

@ -2237,8 +2237,6 @@ function createHttpClient() {
function getCacheVersion() {
// Add salt to cache version to support breaking changes in cache entry
const components = [
core.getInput(constants_1.Inputs.Key, { required: true }),
core.getInput(constants_1.Inputs.RestoreKeys, { required: false }),
core.getInput(constants_1.Inputs.Path, { required: true }),
versionSalt
];
@ -2248,12 +2246,12 @@ function getCacheVersion() {
.digest("hex");
}
exports.getCacheVersion = getCacheVersion;
function getCacheEntry() {
function getCacheEntry(keys) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const httpClient = createHttpClient();
const version = getCacheVersion();
const resource = `cache?version=${version}`;
const resource = `cache?keys=${encodeURIComponent(keys.join(","))}&version=${version}`;
const response = yield httpClient.getJson(getCacheApiUrl(resource));
if (response.statusCode === 204) {
return null;
@ -4588,7 +4586,7 @@ function run() {
}
}
try {
const cacheEntry = yield cacheHttpClient.getCacheEntry();
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys);
if (!((_a = cacheEntry) === null || _a === void 0 ? void 0 : _a.archiveLocation)) {
core.info(`Cache not found for input keys: ${keys.join(", ")}`);
return;