Skip to content

Commit 867dfbc

Browse files
committed
fix: set default value to true to not have to transport the unzip: true when not needed
1 parent 4c3a3fe commit 867dfbc

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

packages/artifact/__tests__/download-artifact.test.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ describe('download-artifact', () => {
179179
fixtures.artifactID,
180180
fixtures.repositoryOwner,
181181
fixtures.repositoryName,
182-
fixtures.token,
183-
{unzip: true}
182+
fixtures.token
184183
)
185184

186185
expect(downloadArtifactMock).toHaveBeenCalledWith({
@@ -224,8 +223,7 @@ describe('download-artifact', () => {
224223
fixtures.artifactID,
225224
fixtures.repositoryOwner,
226225
fixtures.repositoryName,
227-
fixtures.token,
228-
{unzip: true}
226+
fixtures.token
229227
)
230228

231229
expect(downloadArtifactMock).toHaveBeenCalledWith({
@@ -282,8 +280,7 @@ describe('download-artifact', () => {
282280
fixtures.repositoryName,
283281
fixtures.token,
284282
{
285-
path: customPath,
286-
unzip: true
283+
path: customPath
287284
}
288285
)
289286

@@ -319,8 +316,7 @@ describe('download-artifact', () => {
319316
fixtures.artifactID,
320317
fixtures.repositoryOwner,
321318
fixtures.repositoryName,
322-
fixtures.token,
323-
{unzip: true}
319+
fixtures.token
324320
)
325321
).rejects.toBeInstanceOf(Error)
326322

@@ -358,7 +354,7 @@ describe('download-artifact', () => {
358354
)
359355

360356
await expect(
361-
streamExtractExternal(fixtures.blobStorageUrl, fixtures.workspaceDir, {unzip: true})
357+
streamExtractExternal(fixtures.blobStorageUrl, fixtures.workspaceDir)
362358
).rejects.toBeInstanceOf(Error)
363359

364360
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
@@ -389,8 +385,7 @@ describe('download-artifact', () => {
389385
fixtures.artifactID,
390386
fixtures.repositoryOwner,
391387
fixtures.repositoryName,
392-
fixtures.token,
393-
{unzip: true}
388+
fixtures.token
394389
)
395390
).rejects.toBeInstanceOf(Error)
396391

@@ -438,8 +433,7 @@ describe('download-artifact', () => {
438433
fixtures.artifactID,
439434
fixtures.repositoryOwner,
440435
fixtures.repositoryName,
441-
fixtures.token,
442-
{unzip: true}
436+
fixtures.token
443437
)
444438

445439
expect(downloadArtifactMock).toHaveBeenCalledWith({
@@ -557,7 +551,7 @@ describe('download-artifact', () => {
557551
}
558552
)
559553

560-
const response = await downloadArtifactInternal(fixtures.artifactID, {unzip: true})
554+
const response = await downloadArtifactInternal(fixtures.artifactID)
561555

562556
expectExtractedArchive(fixtures.workspaceDir)
563557
expect(response.downloadPath).toBe(fixtures.workspaceDir)
@@ -607,8 +601,7 @@ describe('download-artifact', () => {
607601
)
608602

609603
const response = await downloadArtifactInternal(fixtures.artifactID, {
610-
path: customPath,
611-
unzip: true
604+
path: customPath
612605
})
613606

614607
expectExtractedArchive(customPath)
@@ -632,7 +625,7 @@ describe('download-artifact', () => {
632625
.mockRejectedValue(new Error('boom'))
633626

634627
await expect(
635-
downloadArtifactInternal(fixtures.artifactID, {unzip: true})
628+
downloadArtifactInternal(fixtures.artifactID)
636629
).rejects.toBeInstanceOf(Error)
637630
})
638631

@@ -667,7 +660,7 @@ describe('download-artifact', () => {
667660
)
668661

669662
await expect(
670-
downloadArtifactInternal(fixtures.artifactID, {unzip: true})
663+
downloadArtifactInternal(fixtures.artifactID)
671664
).rejects.toBeInstanceOf(Error)
672665
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
673666
expect(mockListArtifacts).toHaveBeenCalledWith({

packages/artifact/src/internal/download/download-artifact.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export async function streamExtractExternal(
103103

104104
let outputStream: NodeJS.WritableStream;
105105

106-
if (options?.unzip) {
106+
if (options?.unzip ?? true) {
107107
outputStream = unzip.Extract({ path: directory });
108108
} else {
109109
const fileName = `${options?.artifactName ?? 'artifact'}.zip`;

packages/artifact/src/internal/shared/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export interface DownloadArtifactOptions {
115115
expectedHash?: string,
116116

117117
/**
118-
* Whenever to unzip the artifact after download.
118+
* Whenever to unzip the artifact after download. Default to true.
119119
*/
120120
unzip?: boolean
121121
/**
@@ -130,7 +130,7 @@ export interface StreamExtractOptions {
130130
*/
131131
timeout: number
132132
/**
133-
* Whenever to unzip the artifact after download.
133+
* Whenever to unzip the artifact after download. Default to true.
134134
*/
135135
unzip?: boolean
136136
/**

0 commit comments

Comments
 (0)