mirror of https://github.com/actions/toolkit
use require
parent
81a802e7e0
commit
dd26bb1149
|
@ -3,3 +3,4 @@ packages/*/node_modules/
|
||||||
packages/*/lib/
|
packages/*/lib/
|
||||||
packages/glob/__tests__/_temp
|
packages/glob/__tests__/_temp
|
||||||
packages/*/src/generated/*/
|
packages/*/src/generated/*/
|
||||||
|
packages/artifact/src/internal/shared/user-agent.ts
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {RetryOptions, getRetryOptions} from './retry-options'
|
||||||
import {RequestRequestOptions} from '@octokit/types'
|
import {RequestRequestOptions} from '@octokit/types'
|
||||||
import {requestLog} from '@octokit/plugin-request-log'
|
import {requestLog} from '@octokit/plugin-request-log'
|
||||||
import {retry} from '@octokit/plugin-retry'
|
import {retry} from '@octokit/plugin-retry'
|
||||||
|
import * as core from '@actions/core'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
log?: Console
|
log?: Console
|
||||||
|
@ -52,17 +53,23 @@ export async function getArtifact(
|
||||||
)
|
)
|
||||||
|
|
||||||
if (getArtifactResp.status !== 200) {
|
if (getArtifactResp.status !== 200) {
|
||||||
|
core.warning('non-200 response from GitHub API: ${getArtifactResp.status}')
|
||||||
return {
|
return {
|
||||||
success: false
|
success: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getArtifactResp.data.artifacts.length === 0) {
|
if (getArtifactResp.data.artifacts.length === 0) {
|
||||||
|
core.warning('no artifacts found')
|
||||||
return {
|
return {
|
||||||
success: false
|
success: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getArtifactResp.data.artifacts.length > 1) {
|
||||||
|
core.warning('more than one artifact found, returning first')
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
artifact: {
|
artifact: {
|
||||||
|
|
|
@ -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
|
* Ensure that this User Agent String is used in all HTTP calls so that we can monitor telemetry between different versions of this package
|
||||||
|
|
|
@ -16,6 +16,5 @@
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src"
|
"./src"
|
||||||
],
|
]
|
||||||
"resolveJsonModule": true
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue