From 171183c7dce98c3cf8a1fc842429d0a38ed21d33 Mon Sep 17 00:00:00 2001
From: GrantBirki <grant.birkinbine@gmail.com>
Date: Thu, 17 Apr 2025 12:18:37 -0700
Subject: [PATCH] use the same `artifactClient.getArtifact` structure as seen
 above in `isSingleArtifactDownload` logic

---
 src/download-artifact.ts | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/download-artifact.ts b/src/download-artifact.ts
index 693a17a..5414f10 100644
--- a/src/download-artifact.ts
+++ b/src/download-artifact.ts
@@ -114,24 +114,22 @@ export async function run(): Promise<void> {
       core.debug(
         `Only one artifact ID provided. Fetching latest artifact by its name and checking the ID`
       )
-      const getArtifactResponse = await artifactClient.getArtifact(
+      const {artifact: targetArtifact} = await artifactClient.getArtifact(
         inputs.name,
-        {...options}
+        options
       )
 
-      if (!getArtifactResponse || !getArtifactResponse.artifact) {
+      if (!targetArtifact) {
         throw new Error(
           `Artifact with ID '${artifactIds[0]}' not found. Please check the ID.`
         )
       }
 
-      const artifact = getArtifactResponse.artifact
-
       core.debug(
-        `Found artifact by ID '${artifact.name}' (ID: ${artifact.id}, Size: ${artifact.size})`
+        `Found artifact by ID '${targetArtifact.name}' (ID: ${targetArtifact.id}, Size: ${targetArtifact.size})`
       )
 
-      artifacts = [artifact]
+      artifacts = [targetArtifact]
     } else {
       core.info(
         `Multiple artifact IDs provided. Fetching all artifacts to filter by ID`