mirror of https://github.com/actions/toolkit
cleaning up callback methods
parent
d97edf7f61
commit
088b9761b4
|
@ -34,22 +34,11 @@ export async function createZipUploadStream(
|
||||||
}
|
}
|
||||||
const zip = new ZipStream.default(zlibOptions)
|
const zip = new ZipStream.default(zlibOptions)
|
||||||
// register callbacks for various events during the zip lifecycle
|
// register callbacks for various events during the zip lifecycle
|
||||||
zip.on('error', err => {
|
zip.on('error', zipErrorCallback)
|
||||||
core.error('An error has occurred while creating the zip file for upload')
|
|
||||||
core.info(err)
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
'An error has occurred during zip creation for the artifact'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
zip.on('warning', zipWarningCallback)
|
zip.on('warning', zipWarningCallback)
|
||||||
|
|
||||||
zip.on('finish', () => {
|
zip.on('finish', zipFinishCallback)
|
||||||
core.debug('Zip stream for upload has finished.')
|
zip.on('end', zipEndCallback)
|
||||||
})
|
|
||||||
zip.on('end', () => {
|
|
||||||
core.debug('Zip stream for upload has ended.')
|
|
||||||
})
|
|
||||||
|
|
||||||
for (const file of uploadSpecification) {
|
for (const file of uploadSpecification) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
|
@ -82,18 +71,18 @@ export async function createZipUploadStream(
|
||||||
core.debug(
|
core.debug(
|
||||||
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
||||||
)
|
)
|
||||||
|
|
||||||
// zip.pipe(zipUploadStream)
|
|
||||||
zip.finalize()
|
zip.finalize()
|
||||||
return zipUploadStream
|
return zipUploadStream
|
||||||
}
|
}
|
||||||
|
|
||||||
// const zipErrorCallback = (error: any): void => {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
// core.error('An error has occurred while creating the zip file for upload')
|
const zipErrorCallback = (error: any): void => {
|
||||||
// core.info(error)
|
core.error('An error has occurred while creating the zip file for upload')
|
||||||
|
core.info(error)
|
||||||
|
|
||||||
// throw new Error('An error has occurred during zip creation for the artifact')
|
throw new Error('An error has occurred during zip creation for the artifact')
|
||||||
// }
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const zipWarningCallback = (err: any): void => {
|
const zipWarningCallback = (err: any): void => {
|
||||||
if (err.code === 'ENOENT') {
|
if (err.code === 'ENOENT') {
|
||||||
core.warning(
|
core.warning(
|
||||||
|
@ -108,10 +97,10 @@ const zipWarningCallback = (err: any): void => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const zipFinishCallback = (): void => {
|
const zipFinishCallback = (): void => {
|
||||||
// core.debug('Zip stream for upload has finished.')
|
core.debug('Zip stream for upload has finished.')
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const zipEndCallback = (): void => {
|
const zipEndCallback = (): void => {
|
||||||
// core.debug('Zip stream for upload has ended.')
|
core.debug('Zip stream for upload has ended.')
|
||||||
// }
|
}
|
||||||
|
|
Loading…
Reference in New Issue