mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-06 04:13:17 +08:00
Add cache restore dryRun option
This commit is contained in:
17
packages/cache/src/options.ts
vendored
17
packages/cache/src/options.ts
vendored
@@ -53,6 +53,15 @@ export interface DownloadOptions {
|
||||
* @default 3600000
|
||||
*/
|
||||
segmentTimeoutInMs?: number
|
||||
|
||||
/**
|
||||
* Weather to skip downloading the cache entry.
|
||||
* If dryRun is set to true, the restore function will only check if
|
||||
* a matching cache entry exists and return the cache key if it does.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
dryRun?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +101,8 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000
|
||||
segmentTimeoutInMs: 3600000,
|
||||
dryRun: false
|
||||
}
|
||||
|
||||
if (copy) {
|
||||
@@ -111,6 +121,10 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions {
|
||||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs
|
||||
}
|
||||
|
||||
if (typeof copy.dryRun === 'boolean') {
|
||||
result.dryRun = copy.dryRun
|
||||
}
|
||||
}
|
||||
const segmentDownloadTimeoutMins =
|
||||
process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']
|
||||
@@ -129,6 +143,7 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions {
|
||||
`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`
|
||||
)
|
||||
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`)
|
||||
core.debug(`Dry run: ${result.dryRun}`)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user