Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ccc235c6d | ||
|
|
9d24b58739 | ||
|
|
af84eba61e | ||
|
|
385e1ed722 | ||
|
|
336e5e4ce8 | ||
|
|
299d3dd2ec | ||
|
|
8251d0edc0 | ||
|
|
2a53a08370 | ||
|
|
6664f1646a | ||
|
|
ec8e458bdc | ||
|
|
2487627b27 | ||
|
|
71b35793b1 | ||
|
|
4cb65fcdd9 | ||
|
|
77a6cb490e | ||
|
|
a54ac04ab9 | ||
|
|
a4539ea36c | ||
|
|
4e40c6dfc0 | ||
|
|
31035de89b | ||
|
|
bc0e8f3536 | ||
|
|
ba1126827e | ||
|
|
a1a0cc7ebf | ||
|
|
d8025e51e1 | ||
|
|
8fe3522c0b | ||
|
|
05f407f4ff | ||
|
|
429adbf862 | ||
|
|
3c38dcfe1f | ||
|
|
d87ca655a9 | ||
|
|
717b6fd18b |
Vendored
+3
@@ -53,3 +53,6 @@
|
|||||||
|
|
||||||
### 1.0.11
|
### 1.0.11
|
||||||
- Fix file downloads > 2GB([issue](https://github.com/actions/cache/issues/773))
|
- Fix file downloads > 2GB([issue](https://github.com/actions/cache/issues/773))
|
||||||
|
|
||||||
|
### 2.0.0
|
||||||
|
- Added support to check if Actions cache service feature is available or not [#1028](https://github.com/actions/toolkit/pull/1028)
|
||||||
|
|||||||
+2
-2
@@ -3,10 +3,10 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const filePath = process.env[`GITHUB_ENV`]
|
const filePath = process.env[`GITHUB_ENV`]
|
||||||
fs.appendFileSync(filePath, `ACTIONS_RUNTIME_URL=${process.env.ACTIONS_RUNTIME_URL}${os.EOL}`, {
|
fs.appendFileSync(filePath, `ACTIONS_RUNTIME_TOKEN=${process.env.ACTIONS_RUNTIME_TOKEN}${os.EOL}`, {
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
})
|
})
|
||||||
fs.appendFileSync(filePath, `ACTIONS_RUNTIME_TOKEN=${process.env.ACTIONS_RUNTIME_TOKEN}${os.EOL}`, {
|
fs.appendFileSync(filePath, `ACTIONS_CACHE_URL=${process.env.ACTIONS_CACHE_URL}${os.EOL}`, {
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
})
|
})
|
||||||
fs.appendFileSync(filePath, `GITHUB_RUN_ID=${process.env.GITHUB_RUN_ID}${os.EOL}`, {
|
fs.appendFileSync(filePath, `GITHUB_RUN_ID=${process.env.GITHUB_RUN_ID}${os.EOL}`, {
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
import * as cache from '../src/cache'
|
||||||
|
|
||||||
|
test('isFeatureAvailable returns true if server url is set', () => {
|
||||||
|
try {
|
||||||
|
process.env['ACTIONS_CACHE_URL'] = 'http://cache.com'
|
||||||
|
expect(cache.isFeatureAvailable()).toBe(true)
|
||||||
|
} finally {
|
||||||
|
delete process.env['ACTIONS_CACHE_URL']
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
test('isFeatureAvailable returns false if server url is not set', () => {
|
||||||
|
expect(cache.isFeatureAvailable()).toBe(false)
|
||||||
|
})
|
||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "1.0.11",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "1.0.11",
|
"version": "2.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "1.0.11",
|
"version": "2.0.0",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
Vendored
+10
@@ -43,6 +43,16 @@ function checkKey(key: string): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isFeatureAvailable to check the presence of Actions cache service
|
||||||
|
*
|
||||||
|
* @returns boolean return true if Actions cache service feature is available, otherwise false
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function isFeatureAvailable(): boolean {
|
||||||
|
return !!process.env['ACTIONS_CACHE_URL']
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores cache from keys
|
* Restores cache from keys
|
||||||
*
|
*
|
||||||
|
|||||||
+1
-6
@@ -31,12 +31,7 @@ import {
|
|||||||
const versionSalt = '1.0'
|
const versionSalt = '1.0'
|
||||||
|
|
||||||
function getCacheApiUrl(resource: string): string {
|
function getCacheApiUrl(resource: string): string {
|
||||||
// Ideally we just use ACTIONS_CACHE_URL
|
const baseUrl: string = process.env['ACTIONS_CACHE_URL'] || ''
|
||||||
const baseUrl: string = (
|
|
||||||
process.env['ACTIONS_CACHE_URL'] ||
|
|
||||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
|
||||||
''
|
|
||||||
).replace('pipelines', 'artifactcache')
|
|
||||||
if (!baseUrl) {
|
if (!baseUrl) {
|
||||||
throw new Error('Cache Service Url not found, unable to restore cache.')
|
throw new Error('Cache Service Url not found, unable to restore cache.')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user