mirror of
https://github.com/actions/toolkit.git
synced 2026-08-12 00:00:17 +02:00
Added support to check if Artifact cache service is enabled or not.
This commit is contained in:
Vendored
+14
@@ -43,6 +43,20 @@ function checkKey(key: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* isEnable to check the presence of Artifact cache service.
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
|
||||
export function isEnable(): boolean{
|
||||
if (process.env['ACTIONS_CACHE_URL']){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores cache from keys
|
||||
*
|
||||
|
||||
+1
-6
@@ -31,12 +31,7 @@ import {
|
||||
const versionSalt = '1.0'
|
||||
|
||||
function getCacheApiUrl(resource: string): string {
|
||||
// Ideally we just use ACTIONS_CACHE_URL
|
||||
const baseUrl: string = (
|
||||
process.env['ACTIONS_CACHE_URL'] ||
|
||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
||||
''
|
||||
).replace('pipelines', 'artifactcache')
|
||||
const baseUrl: string = process.env['ACTIONS_CACHE_URL'] || ''
|
||||
if (!baseUrl) {
|
||||
throw new Error('Cache Service Url not found, unable to restore cache.')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user