2024-06-17 01:17:10 -07:00
|
|
|
import * as core from '@actions/core'
|
|
|
|
|
|
2024-10-21 05:21:32 -07:00
|
|
|
import {
|
|
|
|
|
BlobClient,
|
|
|
|
|
BlockBlobClient,
|
|
|
|
|
BlobDownloadOptions,
|
|
|
|
|
} from '@azure/storage-blob'
|
2024-06-17 01:17:10 -07:00
|
|
|
|
2024-10-21 05:21:32 -07:00
|
|
|
export async function DownloadCacheFile(
|
|
|
|
|
signedUploadURL: string,
|
|
|
|
|
archivePath: string,
|
|
|
|
|
): Promise<{}> {
|
|
|
|
|
const downloadOptions: BlobDownloadOptions = {
|
|
|
|
|
maxRetryRequests: 5,
|
|
|
|
|
}
|
2024-06-17 01:17:10 -07:00
|
|
|
|
2024-10-21 05:21:32 -07:00
|
|
|
// TODO: tighten the configuration and pass the appropriate user-agent
|
|
|
|
|
const blobClient: BlobClient = new BlobClient(signedUploadURL)
|
|
|
|
|
const blockBlobClient: BlockBlobClient = blobClient.getBlockBlobClient()
|
|
|
|
|
|
|
|
|
|
core.debug(`BlobClient: ${JSON.stringify(blobClient)}`)
|
|
|
|
|
core.debug(`blockBlobClient: ${JSON.stringify(blockBlobClient)}`)
|
|
|
|
|
|
|
|
|
|
return blockBlobClient.downloadToFile(archivePath, 0, undefined, downloadOptions)
|
|
|
|
|
}
|