From 4214a1ff24ee8178826063c6b3d27fe16bb5d719 Mon Sep 17 00:00:00 2001 From: Bethany Date: Tue, 22 Aug 2023 09:57:14 -0700 Subject: [PATCH] update dependencies and prettier --- packages/artifact/package-lock.json | 27 +++++++++++++++++++ packages/artifact/package.json | 1 + .../internal/download/download-artifact.ts | 4 ++- .../src/internal/find/get-artifact.ts | 26 +++++++++--------- .../src/internal/find/list-artifacts.ts | 4 ++- 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/packages/artifact/package-lock.json b/packages/artifact/package-lock.json index d9e415c3..83971346 100644 --- a/packages/artifact/package-lock.json +++ b/packages/artifact/package-lock.json @@ -16,6 +16,7 @@ "@octokit/core": "^3.5.1", "@octokit/plugin-request-log": "^1.0.4", "@octokit/plugin-retry": "^3.0.9", + "@octokit/request-error": "^5.0.0", "@protobuf-ts/plugin": "^2.2.3-alpha.1", "@types/unzipper": "^0.10.6", "archiver": "^5.3.1", @@ -293,6 +294,32 @@ "universal-user-agent": "^6.0.0" } }, + "node_modules/@octokit/request-error": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.0.tgz", + "integrity": "sha512-1ue0DH0Lif5iEqT52+Rf/hf0RmGO9NWFjrzmrkArpG9trFfDM/efx00BJHdLGuro4BR/gECxCU2Twf5OKrRFsQ==", + "dependencies": { + "@octokit/types": "^11.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.0.0.tgz", + "integrity": "sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw==" + }, + "node_modules/@octokit/request-error/node_modules/@octokit/types": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz", + "integrity": "sha512-Fz0+7GyLm/bHt8fwEqgvRBWwIV1S6wRRyq+V6exRKLVWaKGsuy6H9QFYeBVDV7rK6fO3XwHgQOPxv+cLj2zpXQ==", + "dependencies": { + "@octokit/openapi-types": "^18.0.0" + } + }, "node_modules/@octokit/request/node_modules/@octokit/request-error": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", diff --git a/packages/artifact/package.json b/packages/artifact/package.json index e2ebc939..dc776716 100644 --- a/packages/artifact/package.json +++ b/packages/artifact/package.json @@ -46,6 +46,7 @@ "@octokit/core": "^3.5.1", "@octokit/plugin-request-log": "^1.0.4", "@octokit/plugin-retry": "^3.0.9", + "@octokit/request-error": "^5.0.0", "@protobuf-ts/plugin": "^2.2.3-alpha.1", "@types/unzipper": "^0.10.6", "archiver": "^5.3.1", diff --git a/packages/artifact/src/internal/download/download-artifact.ts b/packages/artifact/src/internal/download/download-artifact.ts index ecbac621..6a90364d 100644 --- a/packages/artifact/src/internal/download/download-artifact.ts +++ b/packages/artifact/src/internal/download/download-artifact.ts @@ -61,7 +61,9 @@ export async function downloadArtifact( } if (!(await exists(downloadPath))) { - core.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`) + core.debug( + `Artifact destination folder does not exist, creating: ${downloadPath}` + ) await fs.mkdir(downloadPath, {recursive: true}) } else { core.debug(`Artifact destination folder already exists: ${downloadPath}`) diff --git a/packages/artifact/src/internal/find/get-artifact.ts b/packages/artifact/src/internal/find/get-artifact.ts index 9b40da32..b911e77a 100644 --- a/packages/artifact/src/internal/find/get-artifact.ts +++ b/packages/artifact/src/internal/find/get-artifact.ts @@ -2,7 +2,7 @@ import {Artifact, GetArtifactResponse} from '../shared/interfaces' import {getOctokit} from '@actions/github' import {getUserAgentString} from '../shared/user-agent' import {defaults as defaultGitHubOptions} from '@actions/github/lib/utils' -import { RetryOptions, getRetryOptions } from './retry-options' +import {RetryOptions, getRetryOptions} from './retry-options' import {RequestRequestOptions} from '@octokit/types' import {requestLog} from '@octokit/plugin-request-log' import {retry} from '@octokit/plugin-retry' @@ -25,7 +25,6 @@ export async function getArtifact( repositoryName: string, token: string ): Promise { - const [retryOpts, requestOpts] = getRetryOptions( maxRetryNumber, exemptStatusCodes, @@ -42,22 +41,25 @@ export async function getArtifact( const github = getOctokit(token, opts, retry, requestLog) - const getArtifactResp = await github.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts{?name}', { - owner: repositoryOwner, - repo: repositoryName, - run_id: workflowRunId, - name: artifactName, - }) + const getArtifactResp = await github.request( + 'GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts{?name}', + { + owner: repositoryOwner, + repo: repositoryName, + run_id: workflowRunId, + name: artifactName + } + ) if (getArtifactResp.status !== 200) { return { - success: false, + success: false } } if (getArtifactResp.data.artifacts.length === 0) { return { - success: false, + success: false } } @@ -67,7 +69,7 @@ export async function getArtifact( name: getArtifactResp.data.artifacts[0].name, id: getArtifactResp.data.artifacts[0].id, url: getArtifactResp.data.artifacts[0].url, - size: getArtifactResp.data.artifacts[0].size_in_bytes, - }, + size: getArtifactResp.data.artifacts[0].size_in_bytes + } } } diff --git a/packages/artifact/src/internal/find/list-artifacts.ts b/packages/artifact/src/internal/find/list-artifacts.ts index 7fd96838..2b357ac8 100644 --- a/packages/artifact/src/internal/find/list-artifacts.ts +++ b/packages/artifact/src/internal/find/list-artifacts.ts @@ -29,7 +29,9 @@ export async function listArtifacts( repositoryName: string, token: string ): Promise { - info(`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}`) + info( + `Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}` + ) const artifacts: Artifact[] = [] const [retryOpts, requestOpts] = getRetryOptions(