Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTealeDrest committed Feb 27, 2025
1 parent fcce324 commit 310edc3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/download.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import { mkdtempSync } from 'fs'
import { tmpdir } from 'os'
import { sep } from 'path'
import {DefaultArtifactClient} from '@actions/artifact'

import { DefaultArtifactClient } from '@actions/artifact'

export async function download(name: string): Promise<string> {
const dir = mkdtempSync(`${tmpdir()}${sep}`)
const artifact = new DefaultArtifactClient()

// Fetch list of artifacts for the current workflow run
const artifactResponse = await artifact.listArtifacts()
const artifacts = artifactResponse.artifacts
const { artifacts } = artifactResponse

// Find artifact ID based on name
const matchingArtifact = artifacts.find(a => a.name === name)
const matchingArtifact = artifacts.find((a) => a.name === name)
if (!matchingArtifact) {
throw new Error(`Artifact with name "${name}" not found`)
}

// Download using the artifact ID
await artifact.downloadArtifact(matchingArtifact.id, {
path: dir
path: dir,
})

return dir
Expand Down

0 comments on commit 310edc3

Please sign in to comment.