Skip to content

Commit f57a47d

Browse files
committed
fix: set default value to true to not have to transport the unzip: true when not needed
1 parent e6121b4 commit f57a47d

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
@@ -169,8 +169,7 @@ describe('download-artifact', () => {
169169
fixtures.artifactID,
170170
fixtures.repositoryOwner,
171171
fixtures.repositoryName,
172-
fixtures.token,
173-
{unzip: true}
172+
fixtures.token
174173
)
175174

176175
expect(downloadArtifactMock).toHaveBeenCalledWith({
@@ -214,8 +213,7 @@ describe('download-artifact', () => {
214213
fixtures.artifactID,
215214
fixtures.repositoryOwner,
216215
fixtures.repositoryName,
217-
fixtures.token,
218-
{unzip: true}
216+
fixtures.token
219217
)
220218

221219
expect(downloadArtifactMock).toHaveBeenCalledWith({
@@ -272,8 +270,7 @@ describe('download-artifact', () => {
272270
fixtures.repositoryName,
273271
fixtures.token,
274272
{
275-
path: customPath,
276-
unzip: true
273+
path: customPath
277274
}
278275
)
279276

@@ -309,8 +306,7 @@ describe('download-artifact', () => {
309306
fixtures.artifactID,
310307
fixtures.repositoryOwner,
311308
fixtures.repositoryName,
312-
fixtures.token,
313-
{unzip: true}
309+
fixtures.token
314310
)
315311
).rejects.toBeInstanceOf(Error)
316312

@@ -348,7 +344,7 @@ describe('download-artifact', () => {
348344
)
349345

350346
await expect(
351-
streamExtractExternal(fixtures.blobStorageUrl, fixtures.workspaceDir, {unzip: true})
347+
streamExtractExternal(fixtures.blobStorageUrl, fixtures.workspaceDir)
352348
).rejects.toBeInstanceOf(Error)
353349

354350
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
@@ -379,8 +375,7 @@ describe('download-artifact', () => {
379375
fixtures.artifactID,
380376
fixtures.repositoryOwner,
381377
fixtures.repositoryName,
382-
fixtures.token,
383-
{unzip: true}
378+
fixtures.token
384379
)
385380
).rejects.toBeInstanceOf(Error)
386381

@@ -428,8 +423,7 @@ describe('download-artifact', () => {
428423
fixtures.artifactID,
429424
fixtures.repositoryOwner,
430425
fixtures.repositoryName,
431-
fixtures.token,
432-
{unzip: true}
426+
fixtures.token
433427
)
434428

435429
expect(downloadArtifactMock).toHaveBeenCalledWith({
@@ -547,7 +541,7 @@ describe('download-artifact', () => {
547541
}
548542
)
549543

550-
const response = await downloadArtifactInternal(fixtures.artifactID, {unzip: true})
544+
const response = await downloadArtifactInternal(fixtures.artifactID)
551545

552546
expectExtractedArchive(fixtures.workspaceDir)
553547
expect(response.downloadPath).toBe(fixtures.workspaceDir)
@@ -597,8 +591,7 @@ describe('download-artifact', () => {
597591
)
598592

599593
const response = await downloadArtifactInternal(fixtures.artifactID, {
600-
path: customPath,
601-
unzip: true
594+
path: customPath
602595
})
603596

604597
expectExtractedArchive(customPath)
@@ -622,7 +615,7 @@ describe('download-artifact', () => {
622615
.mockRejectedValue(new Error('boom'))
623616

624617
await expect(
625-
downloadArtifactInternal(fixtures.artifactID, {unzip: true})
618+
downloadArtifactInternal(fixtures.artifactID)
626619
).rejects.toBeInstanceOf(Error)
627620
})
628621

@@ -657,7 +650,7 @@ describe('download-artifact', () => {
657650
)
658651

659652
await expect(
660-
downloadArtifactInternal(fixtures.artifactID, {unzip: true})
653+
downloadArtifactInternal(fixtures.artifactID)
661654
).rejects.toBeInstanceOf(Error)
662655
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
663656
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
@@ -100,7 +100,7 @@ export async function streamExtractExternal(
100100

101101
let outputStream: NodeJS.WritableStream;
102102

103-
if (options?.unzip) {
103+
if (options?.unzip ?? true) {
104104
outputStream = unzip.Extract({ path: directory });
105105
} else {
106106
const fileName = `${options?.artifactName}.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
/**
@@ -126,7 +126,7 @@ export interface DownloadArtifactOptions {
126126

127127
export interface StreamExtractOptions {
128128
/**
129-
* Whenever to unzip the artifact after download.
129+
* Whenever to unzip the artifact after download. Default to true.
130130
*/
131131
unzip?: boolean
132132
/**

0 commit comments

Comments
 (0)