mirror of https://github.com/actions/toolkit
adding promise all
parent
088b9761b4
commit
9299663297
|
@ -40,8 +40,9 @@ export async function createZipUploadStream(
|
||||||
zip.on('finish', zipFinishCallback)
|
zip.on('finish', zipFinishCallback)
|
||||||
zip.on('end', zipEndCallback)
|
zip.on('end', zipEndCallback)
|
||||||
|
|
||||||
for (const file of uploadSpecification) {
|
// for (const file of uploadSpecification) {
|
||||||
await new Promise((resolve, reject) => {
|
const fileUploadPromesses = uploadSpecification.map(async file => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
if (file.sourcePath !== null) {
|
if (file.sourcePath !== null) {
|
||||||
// Add a normal file to the zip
|
// Add a normal file to the zip
|
||||||
zip.entry(
|
zip.entry(
|
||||||
|
@ -61,7 +62,7 @@ export async function createZipUploadStream(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
|
||||||
const bufferSize = getUploadChunkSize()
|
const bufferSize = getUploadChunkSize()
|
||||||
const zipUploadStream = new ZipUploadStream(bufferSize)
|
const zipUploadStream = new ZipUploadStream(bufferSize)
|
||||||
|
@ -71,8 +72,12 @@ export async function createZipUploadStream(
|
||||||
core.debug(
|
core.debug(
|
||||||
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
||||||
)
|
)
|
||||||
zip.finalize()
|
await Promise.all(fileUploadPromesses).then(() => {
|
||||||
return zipUploadStream
|
zip.finalize()
|
||||||
|
|
||||||
|
return zipUploadStream
|
||||||
|
})
|
||||||
|
return Promise.reject(zipUploadStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
|
Loading…
Reference in New Issue