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:
parent
bd756c16ae
commit
072d513f28
6 changed files with 19 additions and 37 deletions
8
dist/restore/index.js
vendored
8
dist/restore/index.js
vendored
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue