Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 98f2ad0

Browse filesBrowse files
authored
Updated @actions/cache (actions#382)
1 parent 5d6f0c8 commit 98f2ad0
Copy full SHA for 98f2ad0

File tree

Expand file treeCollapse file tree

5 files changed

+66
-36
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+66
-36
lines changed

‎.licenses/npm/@actions/cache.dep.yml

Copy file name to clipboardExpand all lines: .licenses/npm/@actions/cache.dep.yml
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/cache-save/index.js

Copy file name to clipboardExpand all lines: dist/cache-save/index.js
+28-13Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,11 @@ function assertDefined(name, value) {
11481148
return value;
11491149
}
11501150
exports.assertDefined = assertDefined;
1151+
function isGhes() {
1152+
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
1153+
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
1154+
}
1155+
exports.isGhes = isGhes;
11511156
//# sourceMappingURL=cacheUtils.js.map
11521157

11531158
/***/ }),
@@ -3806,18 +3811,18 @@ function downloadCache(archiveLocation, archivePath, options) {
38063811
exports.downloadCache = downloadCache;
38073812
// Reserve Cache
38083813
function reserveCache(key, paths, options) {
3809-
var _a, _b;
38103814
return __awaiter(this, void 0, void 0, function* () {
38113815
const httpClient = createHttpClient();
38123816
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
38133817
const reserveCacheRequest = {
38143818
key,
3815-
version
3819+
version,
3820+
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
38163821
};
38173822
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
38183823
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
38193824
}));
3820-
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
3825+
return response;
38213826
});
38223827
}
38233828
exports.reserveCache = reserveCache;
@@ -41528,18 +41533,12 @@ exports.restoreCache = restoreCache;
4152841533
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
4152941534
*/
4153041535
function saveCache(paths, key, options) {
41536+
var _a, _b, _c, _d, _e;
4153141537
return __awaiter(this, void 0, void 0, function* () {
4153241538
checkPaths(paths);
4153341539
checkKey(key);
4153441540
const compressionMethod = yield utils.getCompressionMethod();
41535-
core.debug('Reserving Cache');
41536-
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
41537-
compressionMethod
41538-
});
41539-
if (cacheId === -1) {
41540-
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
41541-
}
41542-
core.debug(`Cache ID: ${cacheId}`);
41541+
let cacheId = null;
4154341542
const cachePaths = yield utils.resolvePaths(paths);
4154441543
core.debug('Cache Paths:');
4154541544
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -41554,9 +41553,24 @@ function saveCache(paths, key, options) {
4155441553
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
4155541554
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
4155641555
core.debug(`File Size: ${archiveFileSize}`);
41557-
if (archiveFileSize > fileSizeLimit) {
41556+
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
41557+
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
4155841558
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
4155941559
}
41560+
core.debug('Reserving Cache');
41561+
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
41562+
compressionMethod,
41563+
cacheSize: archiveFileSize
41564+
});
41565+
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
41566+
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
41567+
}
41568+
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
41569+
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
41570+
}
41571+
else {
41572+
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
41573+
}
4156041574
core.debug(`Saving Cache (ID: ${cacheId})`);
4156141575
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
4156241576
}
@@ -50335,7 +50349,8 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
5033550349
return {
5033650350
statusCode: error.statusCode,
5033750351
result: null,
50338-
headers: {}
50352+
headers: {},
50353+
error
5033950354
};
5034050355
}
5034150356
else {

‎dist/setup/index.js

Copy file name to clipboardExpand all lines: dist/setup/index.js
+28-13Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,11 @@ function assertDefined(name, value) {
11481148
return value;
11491149
}
11501150
exports.assertDefined = assertDefined;
1151+
function isGhes() {
1152+
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
1153+
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
1154+
}
1155+
exports.isGhes = isGhes;
11511156
//# sourceMappingURL=cacheUtils.js.map
11521157

11531158
/***/ }),
@@ -3959,18 +3964,18 @@ function downloadCache(archiveLocation, archivePath, options) {
39593964
exports.downloadCache = downloadCache;
39603965
// Reserve Cache
39613966
function reserveCache(key, paths, options) {
3962-
var _a, _b;
39633967
return __awaiter(this, void 0, void 0, function* () {
39643968
const httpClient = createHttpClient();
39653969
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
39663970
const reserveCacheRequest = {
39673971
key,
3968-
version
3972+
version,
3973+
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
39693974
};
39703975
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
39713976
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
39723977
}));
3973-
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
3978+
return response;
39743979
});
39753980
}
39763981
exports.reserveCache = reserveCache;
@@ -47074,18 +47079,12 @@ exports.restoreCache = restoreCache;
4707447079
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
4707547080
*/
4707647081
function saveCache(paths, key, options) {
47082+
var _a, _b, _c, _d, _e;
4707747083
return __awaiter(this, void 0, void 0, function* () {
4707847084
checkPaths(paths);
4707947085
checkKey(key);
4708047086
const compressionMethod = yield utils.getCompressionMethod();
47081-
core.debug('Reserving Cache');
47082-
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
47083-
compressionMethod
47084-
});
47085-
if (cacheId === -1) {
47086-
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
47087-
}
47088-
core.debug(`Cache ID: ${cacheId}`);
47087+
let cacheId = null;
4708947088
const cachePaths = yield utils.resolvePaths(paths);
4709047089
core.debug('Cache Paths:');
4709147090
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -47100,9 +47099,24 @@ function saveCache(paths, key, options) {
4710047099
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
4710147100
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
4710247101
core.debug(`File Size: ${archiveFileSize}`);
47103-
if (archiveFileSize > fileSizeLimit) {
47102+
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
47103+
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
4710447104
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
4710547105
}
47106+
core.debug('Reserving Cache');
47107+
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
47108+
compressionMethod,
47109+
cacheSize: archiveFileSize
47110+
});
47111+
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
47112+
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
47113+
}
47114+
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
47115+
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
47116+
}
47117+
else {
47118+
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
47119+
}
4710647120
core.debug(`Saving Cache (ID: ${cacheId})`);
4710747121
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
4710847122
}
@@ -56411,7 +56425,8 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
5641156425
return {
5641256426
statusCode: error.statusCode,
5641356427
result: null,
56414-
headers: {}
56428+
headers: {},
56429+
error
5641556430
};
5641656431
}
5641756432
else {

‎package-lock.json

Copy file name to clipboardExpand all lines: package-lock.json
+7-7Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Copy file name to clipboardExpand all lines: package.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-python",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"private": true,
55
"description": "Setup python action",
66
"main": "dist/index.js",
@@ -23,7 +23,7 @@
2323
"author": "GitHub",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@actions/cache": "^2.0.0",
26+
"@actions/cache": "^2.0.2",
2727
"@actions/core": "^1.2.3",
2828
"@actions/exec": "^1.1.0",
2929
"@actions/glob": "^0.2.0",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.