From dd26bb1149d1db07fab41a3074e0592be610180d Mon Sep 17 00:00:00 2001 From: Bethany Date: Tue, 22 Aug 2023 11:33:00 -0700 Subject: [PATCH] use require --- .eslintignore | 1 + packages/artifact/src/internal/find/get-artifact.ts | 7 +++++++ packages/artifact/src/internal/shared/user-agent.ts | 2 +- packages/artifact/tsconfig.json | 3 +-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index 3ac58072..a0478cef 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,4 @@ packages/*/node_modules/ packages/*/lib/ packages/glob/__tests__/_temp packages/*/src/generated/*/ +packages/artifact/src/internal/shared/user-agent.ts diff --git a/packages/artifact/src/internal/find/get-artifact.ts b/packages/artifact/src/internal/find/get-artifact.ts index 60f11319..16cd163b 100644 --- a/packages/artifact/src/internal/find/get-artifact.ts +++ b/packages/artifact/src/internal/find/get-artifact.ts @@ -6,6 +6,7 @@ import {RetryOptions, getRetryOptions} from './retry-options' import {RequestRequestOptions} from '@octokit/types' import {requestLog} from '@octokit/plugin-request-log' import {retry} from '@octokit/plugin-retry' +import * as core from '@actions/core' type Options = { log?: Console @@ -52,17 +53,23 @@ export async function getArtifact( ) if (getArtifactResp.status !== 200) { + core.warning('non-200 response from GitHub API: ${getArtifactResp.status}') return { success: false } } if (getArtifactResp.data.artifacts.length === 0) { + core.warning('no artifacts found') return { success: false } } + if (getArtifactResp.data.artifacts.length > 1) { + core.warning('more than one artifact found, returning first') + } + return { success: true, artifact: { diff --git a/packages/artifact/src/internal/shared/user-agent.ts b/packages/artifact/src/internal/shared/user-agent.ts index ee47a96c..ec8ab1c7 100644 --- a/packages/artifact/src/internal/shared/user-agent.ts +++ b/packages/artifact/src/internal/shared/user-agent.ts @@ -1,4 +1,4 @@ -import * as packageJson from '../../../package.json' +const packageJson = require('../../../package.json') /** * Ensure that this User Agent String is used in all HTTP calls so that we can monitor telemetry between different versions of this package diff --git a/packages/artifact/tsconfig.json b/packages/artifact/tsconfig.json index 048d5b76..cee05147 100644 --- a/packages/artifact/tsconfig.json +++ b/packages/artifact/tsconfig.json @@ -16,6 +16,5 @@ }, "include": [ "./src" - ], - "resolveJsonModule": true + ] }