mirror of https://github.com/actions/toolkit
use on entry
parent
415c42d27c
commit
bc5b3a85ae
|
@ -13,7 +13,7 @@ import {
|
|||
streamExtractExternal
|
||||
} from '../src/internal/download/download-artifact'
|
||||
import {getUserAgentString} from '../src/internal/shared/user-agent'
|
||||
import {noopLogs} from './common'
|
||||
//import {noopLogs} from './common'
|
||||
import * as config from '../src/internal/shared/config'
|
||||
import {ArtifactServiceClientJSON} from '../src/generated'
|
||||
import * as util from '../src/internal/shared/util'
|
||||
|
@ -83,12 +83,13 @@ const createTestArchive = async (): Promise<void> => {
|
|||
const expectExtractedArchive = async (dir: string): Promise<void> => {
|
||||
for (const file of fixtures.exampleArtifact.files) {
|
||||
const filePath = path.join(dir, file.path)
|
||||
console.log('Checking file:', filePath)
|
||||
expect(fs.readFileSync(filePath, 'utf8')).toEqual(file.content)
|
||||
}
|
||||
}
|
||||
|
||||
const setup = async (): Promise<void> => {
|
||||
noopLogs()
|
||||
//noopLogs()
|
||||
await fs.promises.mkdir(testDir, {recursive: true})
|
||||
await createTestArchive()
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import fs from 'fs/promises'
|
||||
import {createWriteStream} from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as github from '@actions/github'
|
||||
import * as core from '@actions/core'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
|
@ -89,7 +91,12 @@ export async function streamExtractExternal(
|
|||
clearTimeout(timer)
|
||||
reject(error)
|
||||
})
|
||||
.pipe(unzip.Extract({path: directory}))
|
||||
.pipe(unzip.Parse())
|
||||
.on('entry', (entry: unzip.Entry) => {
|
||||
const fullPath = path.normalize(path.join(directory, entry.path))
|
||||
core.debug(`Extracting artifact entry: ${fullPath}`)
|
||||
entry.pipe(createWriteStream(fullPath))
|
||||
})
|
||||
.on('close', () => {
|
||||
clearTimeout(timer)
|
||||
resolve()
|
||||
|
|
Loading…
Reference in New Issue