From d97edf7f616b8ed631e3ee8662de0272144f587c Mon Sep 17 00:00:00 2001 From: Vallie Joseph Date: Thu, 28 Mar 2024 16:11:50 +0000 Subject: [PATCH] cleaning up warning callack --- packages/artifact/src/internal/upload/zip.ts | 48 +++++++------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/packages/artifact/src/internal/upload/zip.ts b/packages/artifact/src/internal/upload/zip.ts index 06c596f8..41e4b1de 100644 --- a/packages/artifact/src/internal/upload/zip.ts +++ b/packages/artifact/src/internal/upload/zip.ts @@ -26,9 +26,9 @@ export async function createZipUploadStream( uploadSpecification: UploadZipSpecification[], compressionLevel: number = DEFAULT_COMPRESSION_LEVEL ): Promise { - // core.debug( - // `Creating Artifact archive with compressionLevel: ${compressionLevel}` - // ) + core.debug( + `Creating Artifact archive with compressionLevel: ${compressionLevel}` + ) const zlibOptions = { zlib: {level: compressionLevel, bufferSize: getUploadChunkSize()} } @@ -42,19 +42,7 @@ export async function createZipUploadStream( 'An error has occurred during zip creation for the artifact' ) }) - zip.on('warning', err => { - if (err.code === 'ENOENT') { - core.warning( - 'ENOENT warning during artifact zip creation. No such file or directory' - ) - core.info(err) - } else { - core.warning( - `A non-blocking warning has occurred during artifact zip creation: ${err.code}` - ) - core.info(err) - } - }) + zip.on('warning', zipWarningCallback) zip.on('finish', () => { core.debug('Zip stream for upload has finished.') @@ -106,21 +94,19 @@ export async function createZipUploadStream( // throw new Error('An error has occurred during zip creation for the artifact') // } - -// // eslint-disable-next-line @typescript-eslint/no-explicit-any -// const zipWarningCallback = (error: any): void => { -// if (error.code === 'ENOENT') { -// core.warning( -// 'ENOENT warning during artifact zip creation. No such file or directory' -// ) -// core.info(error) -// } else { -// core.warning( -// `A non-blocking warning has occurred during artifact zip creation: ${error.code}` -// ) -// core.info(error) -// } -// } +const zipWarningCallback = (err: any): void => { + if (err.code === 'ENOENT') { + core.warning( + 'ENOENT warning during artifact zip creation. No such file or directory' + ) + core.info(err) + } else { + core.warning( + `A non-blocking warning has occurred during artifact zip creation: ${err.code}` + ) + core.info(err) + } +} // const zipFinishCallback = (): void => { // core.debug('Zip stream for upload has finished.')