mirror of https://github.com/actions/toolkit
Linter cleanups
parent
b2557ac90c
commit
19cdd5f210
|
@ -4,8 +4,8 @@ import * as config from './internal/config'
|
|||
import * as utils from './internal/cacheUtils'
|
||||
import * as cacheHttpClient from './internal/cacheHttpClient'
|
||||
import * as cacheTwirpClient from './internal/shared/cacheTwirpClient'
|
||||
import {DownloadOptions, UploadOptions} from './options'
|
||||
import {createTar, extractTar, listTar} from './internal/tar'
|
||||
import { DownloadOptions, UploadOptions } from './options'
|
||||
import { createTar, extractTar, listTar } from './internal/tar'
|
||||
import {
|
||||
CreateCacheEntryRequest,
|
||||
CreateCacheEntryResponse,
|
||||
|
@ -14,9 +14,9 @@ import {
|
|||
GetCacheEntryDownloadURLRequest,
|
||||
GetCacheEntryDownloadURLResponse
|
||||
} from './generated/results/api/v1/cache'
|
||||
import {CacheFileSizeLimit} from './internal/constants'
|
||||
import {UploadCacheFile} from './internal/blob/upload-cache'
|
||||
import {DownloadCacheFile} from './internal/blob/download-cache'
|
||||
import { CacheFileSizeLimit } from './internal/constants'
|
||||
import { UploadCacheFile } from './internal/blob/upload-cache'
|
||||
import { DownloadCacheFile } from './internal/blob/download-cache'
|
||||
export class ValidationError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message)
|
||||
|
@ -84,7 +84,6 @@ export async function restoreCache(
|
|||
checkPaths(paths)
|
||||
|
||||
const cacheServiceVersion: string = config.getCacheServiceVersion()
|
||||
console.debug(`Cache service version: ${cacheServiceVersion}`)
|
||||
switch (cacheServiceVersion) {
|
||||
case 'v2':
|
||||
return await restoreCachev2(
|
||||
|
@ -246,7 +245,7 @@ async function restoreCachev2(
|
|||
workflowRunBackendId: backendIds.workflowRunBackendId,
|
||||
workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
|
||||
key: primaryKey,
|
||||
restoreKeys: restoreKeys,
|
||||
restoreKeys,
|
||||
version: utils.getCacheVersion(
|
||||
paths,
|
||||
compressionMethod,
|
||||
|
@ -307,8 +306,6 @@ async function restoreCachev2(
|
|||
core.debug(`Failed to delete archive: ${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,7 +327,6 @@ export async function saveCache(
|
|||
checkKey(key)
|
||||
|
||||
const cacheServiceVersion: string = config.getCacheServiceVersion()
|
||||
console.debug(`Cache Service Version: ${cacheServiceVersion}`)
|
||||
switch (cacheServiceVersion) {
|
||||
case 'v2':
|
||||
return await saveCachev2(paths, key, options, enableCrossOsArchive)
|
||||
|
@ -410,9 +406,9 @@ async function saveCachev1(
|
|||
} else if (reserveCacheResponse?.statusCode === 400) {
|
||||
throw new Error(
|
||||
reserveCacheResponse?.error?.message ??
|
||||
`Cache size of ~${Math.round(
|
||||
archiveFileSize / (1024 * 1024)
|
||||
)} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`
|
||||
`Cache size of ~${Math.round(
|
||||
archiveFileSize / (1024 * 1024)
|
||||
)} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`
|
||||
)
|
||||
} else {
|
||||
throw new ReserveCacheError(
|
||||
|
@ -509,8 +505,8 @@ async function saveCachev2(
|
|||
const request: CreateCacheEntryRequest = {
|
||||
workflowRunBackendId: backendIds.workflowRunBackendId,
|
||||
workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
|
||||
key: key,
|
||||
version: version
|
||||
key,
|
||||
version
|
||||
}
|
||||
const response: CreateCacheEntryResponse =
|
||||
await twirpClient.CreateCacheEntry(request)
|
||||
|
@ -526,8 +522,8 @@ async function saveCachev2(
|
|||
const finalizeRequest: FinalizeCacheEntryUploadRequest = {
|
||||
workflowRunBackendId: backendIds.workflowRunBackendId,
|
||||
workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
|
||||
key: key,
|
||||
version: version,
|
||||
key,
|
||||
version,
|
||||
sizeBytes: `${archiveFileSize}`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue