Change variable path to a list

This commit is contained in:
Aiqiao Yan
2020-05-06 17:53:22 -04:00
parent 932779cf58
commit 7409ad5fae
9 changed files with 216 additions and 414 deletions
+6 -6
View File
@@ -84,10 +84,10 @@ function createHttpClient(): HttpClient {
}
export function getCacheVersion(
inputPath: string,
paths: string[],
compressionMethod?: CompressionMethod
): string {
const components = [inputPath].concat(
const components = paths.concat(
compressionMethod === CompressionMethod.Zstd ? [compressionMethod] : []
)
@@ -102,11 +102,11 @@ export function getCacheVersion(
export async function getCacheEntry(
keys: string[],
inputPath: string,
paths: string[],
options?: CacheOptions
): Promise<ArtifactCacheEntry | null> {
const httpClient = createHttpClient()
const version = getCacheVersion(inputPath, options?.compressionMethod)
const version = getCacheVersion(paths, options?.compressionMethod)
const resource = `cache?keys=${encodeURIComponent(
keys.join(',')
)}&version=${version}`
@@ -177,11 +177,11 @@ export async function downloadCache(
// Reserve Cache
export async function reserveCache(
key: string,
inputPath: string,
paths: string[],
options?: CacheOptions
): Promise<number> {
const httpClient = createHttpClient()
const version = getCacheVersion(inputPath, options?.compressionMethod)
const version = getCacheVersion(paths, options?.compressionMethod)
const reserveCacheRequest: ReserveCacheRequest = {
key,