1
0
Fork 0
mirror of https://github.com/actions/cache.git synced 2025-07-12 09:10:44 +00: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

@ -84,8 +84,6 @@ function createHttpClient(): HttpClient {
export function getCacheVersion(): string {
// Add salt to cache version to support breaking changes in cache entry
const components = [
core.getInput(Inputs.Key, { required: true }),
core.getInput(Inputs.RestoreKeys, { required: false }),
core.getInput(Inputs.Path, { required: true }),
versionSalt
];
@ -96,10 +94,14 @@ export function getCacheVersion(): string {
.digest("hex");
}
export async function getCacheEntry(): Promise<ArtifactCacheEntry | null> {
export async function getCacheEntry(
keys: string[]
): Promise<ArtifactCacheEntry | null> {
const httpClient = createHttpClient();
const version = getCacheVersion();
const resource = `cache?version=${version}`;
const resource = `cache?keys=${encodeURIComponent(
keys.join(",")
)}&version=${version}`;
const response = await httpClient.getJson<ArtifactCacheEntry>(
getCacheApiUrl(resource)