Simplify patch

This commit is contained in:
Daz DeBoer 2022-08-16 17:30:58 -06:00
parent 25e9b4d3f6
commit 8df5664474
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
5 changed files with 8 additions and 81 deletions

24
dist/main/index.js vendored
View file

@ -115,17 +115,6 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
core.info('Cache restored successfully'); core.info('Cache restored successfully');
return restoredEntry; return restoredEntry;
} }
// PATCH: Error handling is done in action code, allowing us to provide better reporting
// catch (error) {
// const typedError = error;
// if (typedError.name === ValidationError.name) {
// throw error;
// }
// else {
// // Supress all non-validation cache related errors because caching should be optional
// core.warning(`Failed to restore: ${error.message}`);
// }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@ -194,19 +183,6 @@ function saveCache(paths, key, options) {
core.debug(`Saving Cache (ID: ${cacheId})`); core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options); yield cacheHttpClient.saveCache(cacheId, archivePath, options);
} }
// PATCH: Error handling is done in action code, allowing us to provide better reporting
// catch (error) {
// const typedError = error;
// if (typedError.name === ValidationError.name) {
// throw error;
// }
// else if (typedError.name === ReserveCacheError.name) {
// core.info(`Failed to save: ${typedError.message}`);
// }
// else {
// core.warning(`Failed to save: ${typedError.message}`);
// }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {

File diff suppressed because one or more lines are too long

24
dist/post/index.js vendored
View file

@ -115,17 +115,6 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
core.info('Cache restored successfully'); core.info('Cache restored successfully');
return restoredEntry; return restoredEntry;
} }
// PATCH: Error handling is done in action code, allowing us to provide better reporting
// catch (error) {
// const typedError = error;
// if (typedError.name === ValidationError.name) {
// throw error;
// }
// else {
// // Supress all non-validation cache related errors because caching should be optional
// core.warning(`Failed to restore: ${error.message}`);
// }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@ -194,19 +183,6 @@ function saveCache(paths, key, options) {
core.debug(`Saving Cache (ID: ${cacheId})`); core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options); yield cacheHttpClient.saveCache(cacheId, archivePath, options);
} }
// PATCH: Error handling is done in action code, allowing us to provide better reporting
// catch (error) {
// const typedError = error;
// if (typedError.name === ValidationError.name) {
// throw error;
// }
// else if (typedError.name === ReserveCacheError.name) {
// core.info(`Failed to save: ${typedError.message}`);
// }
// else {
// core.warning(`Failed to save: ${typedError.message}`);
// }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {

File diff suppressed because one or more lines are too long

View file

@ -26,10 +26,10 @@ index 16b20f7..aea77ba 100644
+ constructor(key: string, size?: number); + constructor(key: string, size?: number);
+} +}
diff --git a/node_modules/@actions/cache/lib/cache.js b/node_modules/@actions/cache/lib/cache.js diff --git a/node_modules/@actions/cache/lib/cache.js b/node_modules/@actions/cache/lib/cache.js
index 4dc5e88..9cb8123 100644 index 4dc5e88..92d99d5 100644
--- a/node_modules/@actions/cache/lib/cache.js --- a/node_modules/@actions/cache/lib/cache.js
+++ b/node_modules/@actions/cache/lib/cache.js +++ b/node_modules/@actions/cache/lib/cache.js
@@ -95,27 +95,30 @@ function restoreCache(paths, primaryKey, restoreKeys, options) { @@ -95,26 +95,18 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
} }
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`); core.debug(`Archive Path: ${archivePath}`);
@ -57,21 +57,9 @@ index 4dc5e88..9cb8123 100644
- } - }
+ return restoredEntry; + return restoredEntry;
} }
+ // PATCH: Error handling is done in action code, allowing us to provide better reporting
+ // catch (error) {
+ // const typedError = error;
+ // if (typedError.name === ValidationError.name) {
+ // throw error;
+ // }
+ // else {
+ // // Supress all non-validation cache related errors because caching should be optional
+ // core.warning(`Failed to restore: ${error.message}`);
+ // }
+ // }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { @@ -153,6 +145,7 @@ function saveCache(paths, key, options) {
@@ -153,6 +156,7 @@ function saveCache(paths, key, options) {
const archiveFolder = yield utils.createTempDirectory(); const archiveFolder = yield utils.createTempDirectory();
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod)); const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`); core.debug(`Archive Path: ${archivePath}`);
@ -79,7 +67,7 @@ index 4dc5e88..9cb8123 100644
try { try {
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod); yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
if (core.isDebug()) { if (core.isDebug()) {
@@ -160,6 +164,7 @@ function saveCache(paths, key, options) { @@ -160,6 +153,7 @@ function saveCache(paths, key, options) {
} }
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
@ -87,7 +75,7 @@ index 4dc5e88..9cb8123 100644
core.debug(`File Size: ${archiveFileSize}`); core.debug(`File Size: ${archiveFileSize}`);
// For GHES, this check will take place in ReserveCache API with enterprise file size limit // For GHES, this check will take place in ReserveCache API with enterprise file size limit
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) { if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
@@ -182,18 +187,19 @@ function saveCache(paths, key, options) { @@ -182,18 +176,6 @@ function saveCache(paths, key, options) {
core.debug(`Saving Cache (ID: ${cacheId})`); core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options); yield cacheHttpClient.saveCache(cacheId, archivePath, options);
} }
@ -103,23 +91,10 @@ index 4dc5e88..9cb8123 100644
- core.warning(`Failed to save: ${typedError.message}`); - core.warning(`Failed to save: ${typedError.message}`);
- } - }
- } - }
+ // PATCH: Error handling is done in action code, allowing us to provide better reporting
+ // catch (error) {
+ // const typedError = error;
+ // if (typedError.name === ValidationError.name) {
+ // throw error;
+ // }
+ // else if (typedError.name === ReserveCacheError.name) {
+ // core.info(`Failed to save: ${typedError.message}`);
+ // }
+ // else {
+ // core.warning(`Failed to save: ${typedError.message}`);
+ // }
+ // }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@@ -203,8 +209,15 @@ function saveCache(paths, key, options) { @@ -203,8 +185,15 @@ function saveCache(paths, key, options) {
core.debug(`Failed to delete archive: ${error}`); core.debug(`Failed to delete archive: ${error}`);
} }
} }