File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -371,4 +371,37 @@ describe('download', () => {
371371 "Inputs 'name' and 'artifact-ids' cannot be used together. Please specify only one."
372372 )
373373 } )
374+
375+ test ( 'downloads single artifact by ID to same path as by name' , async ( ) => {
376+ const mockArtifact = {
377+ id : 456 ,
378+ name : 'test-artifact' ,
379+ size : 1024 ,
380+ digest : 'def456'
381+ }
382+
383+ mockInputs ( {
384+ [ Inputs . Name ] : '' ,
385+ [ Inputs . Pattern ] : '' ,
386+ [ Inputs . ArtifactIds ] : '456' ,
387+ [ Inputs . Path ] : '/test/path'
388+ } )
389+
390+ jest . spyOn ( artifact , 'listArtifacts' ) . mockImplementation ( ( ) =>
391+ Promise . resolve ( {
392+ artifacts : [ mockArtifact ]
393+ } )
394+ )
395+
396+ await run ( )
397+
398+ // Verify it downloads directly to the specified path (not nested in artifact name subdirectory)
399+ expect ( artifact . downloadArtifact ) . toHaveBeenCalledWith (
400+ 456 ,
401+ expect . objectContaining ( {
402+ path : '/test/path' , // Should be the resolved path directly, not /test/path/test-artifact
403+ expectedHash : mockArtifact . digest
404+ } )
405+ )
406+ } )
374407} )
Original file line number Diff line number Diff line change @@ -174,7 +174,9 @@ export async function run(): Promise<void> {
174174 promise : artifactClient . downloadArtifact ( artifact . id , {
175175 ...options ,
176176 path :
177- isSingleArtifactDownload || inputs . mergeMultiple
177+ isSingleArtifactDownload ||
178+ inputs . mergeMultiple ||
179+ artifacts . length === 1
178180 ? resolvedPath
179181 : path . join ( resolvedPath , artifact . name ) ,
180182 expectedHash : artifact . digest
You can’t perform that action at this time.
0 commit comments