From 3aaff6685bad835f3ea399d50cf01ca62845a532 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Mon, 21 Aug 2023 17:47:17 -0400 Subject: [PATCH] cleanup --- .../src/internal/download/download-artifact.ts | 14 +++++++------- .../artifact/src/internal/shared/interfaces.ts | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/artifact/src/internal/download/download-artifact.ts b/packages/artifact/src/internal/download/download-artifact.ts index 0c6d0306..17699dec 100644 --- a/packages/artifact/src/internal/download/download-artifact.ts +++ b/packages/artifact/src/internal/download/download-artifact.ts @@ -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} } diff --git a/packages/artifact/src/internal/shared/interfaces.ts b/packages/artifact/src/internal/shared/interfaces.ts index d1f7a7aa..4f9a5c43 100644 --- a/packages/artifact/src/internal/shared/interfaces.ts +++ b/packages/artifact/src/internal/shared/interfaces.ts @@ -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 {