mirror of https://github.com/actions/toolkit
Added support to check if Artifact cache service is enabled or not.
parent
d1abf7dc74
commit
717b6fd18b
|
@ -50,3 +50,6 @@
|
|||
|
||||
### 1.0.10
|
||||
- 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.
|
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@actions/cache",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.11",
|
||||
"preview": true,
|
||||
"description": "Actions cache lib",
|
||||
"keywords": [
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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.')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue