mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-08-22 13:49:13 +08:00
removing promise wrap
This commit is contained in:
parent
6e1d7543c4
commit
da5e926162
@ -43,11 +43,10 @@ export async function createZipUploadStream(
|
|||||||
const zipUploadStream = new ZipUploadStream(bufferSize)
|
const zipUploadStream = new ZipUploadStream(bufferSize)
|
||||||
zip.pipe(zipUploadStream)
|
zip.pipe(zipUploadStream)
|
||||||
// register callbacks for various events during the zip lifecycle
|
// register callbacks for various events during the zip lifecycle
|
||||||
zip.on('warning', zipWarningCallback)
|
|
||||||
zip.on('error', zipErrorCallback)
|
zip.on('error', zipErrorCallback)
|
||||||
|
zip.on('warning', zipWarningCallback)
|
||||||
zip.on('finish', zipFinishCallback)
|
zip.on('finish', zipFinishCallback)
|
||||||
zip.on('end', zipEndCallback)
|
zip.on('end', zipEndCallback)
|
||||||
|
|
||||||
const addFileToZip = (
|
const addFileToZip = (
|
||||||
file: UploadZipSpecification,
|
file: UploadZipSpecification,
|
||||||
callback: (error?: Error) => void
|
callback: (error?: Error) => void
|
||||||
@ -75,24 +74,23 @@ export async function createZipUploadStream(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
async.eachSeries(uploadSpecification, addFileToZip, (error: unknown) => {
|
||||||
async.eachSeries(uploadSpecification, addFileToZip, (error: unknown) => {
|
if (error) {
|
||||||
if (error) {
|
core.error('Failed to add a file to the zip:')
|
||||||
core.error('Failed to add a file to the zip:')
|
core.info(error.toString()) // Convert error to string
|
||||||
core.info(error.toString()) // Convert error to string
|
return
|
||||||
reject(error)
|
}
|
||||||
return
|
zip.finalize() // Finalize the archive once all files have been added
|
||||||
}
|
|
||||||
zip.finalize() // Finalize the archive once all files have been added
|
|
||||||
core.debug(
|
|
||||||
`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`
|
|
||||||
)
|
|
||||||
core.debug(
|
|
||||||
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
|
||||||
)
|
|
||||||
resolve(zipUploadStream)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
core.debug(
|
||||||
|
`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`
|
||||||
|
)
|
||||||
|
core.debug(
|
||||||
|
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
||||||
|
)
|
||||||
|
|
||||||
|
return zipUploadStream
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
2
packages/attest/package-lock.json
generated
2
packages/attest/package-lock.json
generated
@ -3561,4 +3561,4 @@
|
|||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user