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,
|
2024-11-14 03:22:03 -08:00
|
|
|
BlobDownloadOptions
|
2024-10-21 05:21:32 -07:00
|
|
|
} 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,
|
2024-11-14 03:22:03 -08:00
|
|
|
archivePath: string
|
2024-10-21 05:21:32 -07:00
|
|
|
): Promise<{}> {
|
|
|
|
|
const downloadOptions: BlobDownloadOptions = {
|
2024-11-14 03:22:03 -08:00
|
|
|
maxRetryRequests: 5
|
2024-10-21 05:21:32 -07:00
|
|
|
}
|
2024-06-17 01:17:10 -07:00
|
|
|
|
2024-10-21 05:21:32 -07:00
|
|
|
const blobClient: BlobClient = new BlobClient(signedUploadURL)
|
|
|
|
|
const blockBlobClient: BlockBlobClient = blobClient.getBlockBlobClient()
|
|
|
|
|
|
2024-11-14 04:47:27 -08:00
|
|
|
core.debug(
|
|
|
|
|
`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`
|
|
|
|
|
)
|
2024-10-21 05:21:32 -07:00
|
|
|
|
2024-11-14 03:22:03 -08:00
|
|
|
return blockBlobClient.downloadToFile(
|
|
|
|
|
archivePath,
|
|
|
|
|
0,
|
|
|
|
|
undefined,
|
|
|
|
|
downloadOptions
|
|
|
|
|
)
|
|
|
|
|
}
|