diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index cce6d327..cb1ddb71 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -49,4 +49,7 @@ - Use @azure/storage-blob v12.8.0 ### 1.0.10 -- Update `lockfileVersion` to `v2` in `package-lock.json [#1022](https://github.com/actions/toolkit/pull/1022) \ No newline at end of file +- Update `lockfileVersion` to `v2` in `package-lock.json [#1022](https://github.com/actions/toolkit/pull/1022) + +### 1.0.10 +- Added support to check if Artifact cache service is enabled or not. \ No newline at end of file diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index 126c8fd6..2d7af851 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "1.0.10", + "version": "1.0.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "1.0.10", + "version": "1.0.11", "license": "MIT", "dependencies": { "@actions/core": "^1.2.6", diff --git a/packages/cache/package.json b/packages/cache/package.json index b675f49c..7b7c31a4 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "1.0.10", + "version": "1.0.11", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index 540d639c..0c998f05 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -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 * diff --git a/packages/cache/src/internal/cacheHttpClient.ts b/packages/cache/src/internal/cacheHttpClient.ts index 6a46f736..65d7bd08 100644 --- a/packages/cache/src/internal/cacheHttpClient.ts +++ b/packages/cache/src/internal/cacheHttpClient.ts @@ -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.') }