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

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,

View File

@@ -38,11 +38,6 @@ export function getArchiveFileSize(filePath: string): number {
return fs.statSync(filePath).size
}
export function logWarning(message: string): void {
const warningPrefix = '[warning]'
core.info(`${warningPrefix}${message}`)
}
export async function resolvePaths(patterns: string[]): Promise<string[]> {
const paths: string[] = []
const workspace = process.env['GITHUB_WORKSPACE'] ?? process.cwd()