mirror of
https://github.com/actions/toolkit.git
synced 2026-08-11 00:00:28 +02:00
Add cross os opt-in functionality for cache on windows
This commit is contained in:
Vendored
+7
-1
@@ -61,6 +61,7 @@ export function isFeatureAvailable(): boolean {
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param crossOsEnabled an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @param downloadOptions cache download options
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
@@ -68,6 +69,7 @@ export async function restoreCache(
|
||||
paths: string[],
|
||||
primaryKey: string,
|
||||
restoreKeys?: string[],
|
||||
crossOsEnabled = false,
|
||||
options?: DownloadOptions
|
||||
): Promise<string | undefined> {
|
||||
checkPaths(paths)
|
||||
@@ -93,7 +95,8 @@ export async function restoreCache(
|
||||
try {
|
||||
// path are needed to compute version
|
||||
cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
compressionMethod
|
||||
compressionMethod,
|
||||
crossOsEnabled
|
||||
})
|
||||
if (!cacheEntry?.archiveLocation) {
|
||||
// This is to support the old cache entry created by gzip on windows.
|
||||
@@ -171,12 +174,14 @@ export async function restoreCache(
|
||||
*
|
||||
* @param paths a list of file paths to be cached
|
||||
* @param key an explicit key for restoring the cache
|
||||
* @param crossOsEnabled an optional boolean enabled to save cache on windows which could be restored on any platform
|
||||
* @param options cache upload options
|
||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
export async function saveCache(
|
||||
paths: string[],
|
||||
key: string,
|
||||
crossOsEnabled = false,
|
||||
options?: UploadOptions
|
||||
): Promise<number> {
|
||||
checkPaths(paths)
|
||||
@@ -227,6 +232,7 @@ export async function saveCache(
|
||||
paths,
|
||||
{
|
||||
compressionMethod,
|
||||
crossOsEnabled,
|
||||
cacheSize: archiveFileSize
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user