1
0
Fork 0
pull/1505/head
Rob Herley 2023-08-21 17:47:17 -04:00
parent 9b383229c1
commit 3aaff6685b
No known key found for this signature in database
GPG Key ID: D1602042C3543B06
2 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,9 @@
import path from 'path'
import fs from 'fs/promises'
import {PathLike} from 'fs'
import github from '@actions/github'
import core from '@actions/core'
import httpClient from '@actions/http-client'
import * as github from '@actions/github'
import * as core from '@actions/core'
import * as httpClient from '@actions/http-client'
import unzipper from 'unzipper'
import {
DownloadArtifactOptions,
@ -61,16 +61,16 @@ export async function downloadArtifact(
}
if (!(await exists(downloadPath))) {
core.debug(`Creating artifact folder: ${downloadPath}`)
core.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`)
await fs.mkdir(downloadPath, {recursive: true})
} else {
core.warning(`Artifact folder already exists: ${downloadPath}`)
core.debug(`Artifact destination folder already exists: ${downloadPath}`)
}
const api = github.getOctokit(token)
core.info(
`Downloading artifact ${artifactId} from ${repositoryOwner}/${repositoryName}`
`Downloading artifact '${artifactId}' from '${repositoryOwner}/${repositoryName}'`
)
const {headers, status} = await api.rest.actions.downloadArtifact({
@ -104,5 +104,5 @@ export async function downloadArtifact(
throw new Error(`Unable to download and extract artifact: ${error.message}`)
}
return {success: true}
return {success: true, downloadPath}
}

View File

@ -80,6 +80,10 @@ export interface DownloadArtifactResponse {
* If the artifact download was successful
*/
success: boolean
/**
* The path where the artifact was downloaded to
*/
downloadPath?: string
}
export interface DownloadArtifactOptions {