1
0
Fork 0

Refactor code formatting for consistency and readability

pull/1882/head
Bassem Dghaidi 2024-11-27 05:58:22 -08:00 committed by GitHub
parent af3981c955
commit 35d87ab129
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 19 deletions

View File

@ -3,18 +3,18 @@ import * as path from 'path'
import * as utils from './internal/cacheUtils'
import * as cacheHttpClient from './internal/cacheHttpClient'
import * as cacheTwirpClient from './internal/shared/cacheTwirpClient'
import { downloadCacheStorageSDK } from './internal/downloadUtils'
import { getCacheServiceVersion, isGhes } from './internal/config'
import { DownloadOptions, UploadOptions } from './options'
import { createTar, extractTar, listTar } from './internal/tar'
import {downloadCacheStorageSDK} from './internal/downloadUtils'
import {getCacheServiceVersion, isGhes} from './internal/config'
import {DownloadOptions, UploadOptions} from './options'
import {createTar, extractTar, listTar} from './internal/tar'
import {
CreateCacheEntryRequest,
FinalizeCacheEntryUploadRequest,
FinalizeCacheEntryUploadResponse,
GetCacheEntryDownloadURLRequest
} from './generated/results/api/v1/cache'
import { CacheFileSizeLimit } from './internal/constants'
import { uploadCacheFile } from './internal/blob/upload-cache'
import {CacheFileSizeLimit} from './internal/constants'
import {uploadCacheFile} from './internal/blob/upload-cache'
export class ValidationError extends Error {
constructor(message: string) {
super(message)
@ -275,9 +275,9 @@ async function restoreCacheV2(
response.signedDownloadUrl,
archivePath,
options ||
({
timeoutInMs: 30000
} as DownloadOptions)
({
timeoutInMs: 30000
} as DownloadOptions)
)
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
@ -414,9 +414,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(

View File

@ -1,12 +1,12 @@
import * as core from '@actions/core'
import { HttpClient } from '@actions/http-client'
import { BearerCredentialHandler } from '@actions/http-client/lib/auth'
import {HttpClient} from '@actions/http-client'
import {BearerCredentialHandler} from '@actions/http-client/lib/auth'
import {
RequestOptions,
TypedResponse
} from '@actions/http-client/lib/interfaces'
import * as fs from 'fs'
import { URL } from 'url'
import {URL} from 'url'
import * as utils from './cacheUtils'
import {
ArtifactCacheEntry,
@ -33,8 +33,8 @@ import {
retryHttpClientResponse,
retryTypedResponse
} from './requestUtils'
import { getCacheServiceURL } from './config'
import { getUserAgentString } from './shared/user-agent'
import {getCacheServiceURL} from './config'
import {getUserAgentString} from './shared/user-agent'
function getCacheApiUrl(resource: string): string {
const baseUrl: string = getCacheServiceURL()
@ -217,7 +217,8 @@ async function uploadChunk(
end: number
): Promise<void> {
core.debug(
`Uploading chunk of size ${end - start + 1
`Uploading chunk of size ${
end - start + 1
} bytes at offset ${start} with content range: ${getContentRange(
start,
end
@ -313,7 +314,7 @@ async function commitCache(
cacheId: number,
filesize: number
): Promise<TypedResponse<null>> {
const commitCacheRequest: CommitCacheRequest = { size: filesize }
const commitCacheRequest: CommitCacheRequest = {size: filesize}
return await retryTypedResponse('commitCache', async () =>
httpClient.postJson<null>(
getCacheApiUrl(`caches/${cacheId.toString()}`),