mirror of
https://github.com/actions/toolkit.git
synced 2026-08-13 00:00:44 +02:00
Format
This commit is contained in:
Vendored
+14
-14
@@ -4,7 +4,7 @@ import * as utils from './internal/cacheUtils'
|
||||
import * as cacheHttpClient from './internal/cacheHttpClient'
|
||||
import {createTar, extractTar, listTar} from './internal/tar'
|
||||
import {DownloadOptions, UploadOptions} from './options'
|
||||
import { ArtifactCacheEntry } from './internal/contracts'
|
||||
import {ArtifactCacheEntry} from './internal/contracts'
|
||||
|
||||
export class ValidationError extends Error {
|
||||
constructor(message: string) {
|
||||
@@ -87,10 +87,10 @@ export async function restoreCache(
|
||||
}
|
||||
|
||||
const compressionMethod = await utils.getCompressionMethod()
|
||||
let archivePath = ""
|
||||
let archivePath = ''
|
||||
try {
|
||||
// path are needed to compute version
|
||||
const cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
// path are needed to compute version
|
||||
const cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
compressionMethod
|
||||
})
|
||||
|
||||
@@ -98,13 +98,13 @@ export async function restoreCache(
|
||||
// Cache not found
|
||||
return undefined
|
||||
}
|
||||
|
||||
archivePath = path.join(
|
||||
|
||||
archivePath = path.join(
|
||||
await utils.createTempDirectory(),
|
||||
utils.getCacheFileName(compressionMethod)
|
||||
)
|
||||
core.debug(`Archive Path: ${archivePath}`)
|
||||
|
||||
|
||||
// Download the cache from the cache entry
|
||||
await cacheHttpClient.downloadCache(
|
||||
cacheEntry.archiveLocation,
|
||||
@@ -125,12 +125,12 @@ export async function restoreCache(
|
||||
|
||||
await extractTar(archivePath, compressionMethod)
|
||||
core.info('Cache restored successfully')
|
||||
|
||||
|
||||
return cacheEntry.cacheKey
|
||||
} catch(error) {
|
||||
// Supress all cache related errors because caching should be optional
|
||||
core.warning(`Fail to restore: ${error}`);
|
||||
}finally {
|
||||
} catch (error) {
|
||||
// Supress all cache related errors because caching should be optional
|
||||
core.warning(`Fail to restore: ${error}`)
|
||||
} finally {
|
||||
// Try to delete the archive to save space
|
||||
try {
|
||||
await utils.unlinkFile(archivePath)
|
||||
@@ -224,8 +224,8 @@ export async function saveCache(
|
||||
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`)
|
||||
await cacheHttpClient.saveCache(cacheId, archivePath, options)
|
||||
} catch(error) {
|
||||
const typedError = error as Error;
|
||||
} catch (error) {
|
||||
const typedError = error as Error
|
||||
if (typedError.name === ReserveCacheError.name) {
|
||||
core.info(`Fail to save: ${typedError.message}`)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user