mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 18:23:16 +08:00
Update other packages to use http-client v2 (#1082)
We moved `@actions/http-client` to be part of the toolkit in https://github.com/actions/toolkit/pull/1062. We also made some breaking changes to exported types and released v2. The biggest change in terms of lines of code affected was to get rid of the `I-` prefix for interfaces since TypeScript doesn't follow this convention. I bumped the patch version of all packages except for `tool-cache`, where I bumped the major version. The rationale is explained in the release notes for that package.
This commit is contained in:
@@ -8,12 +8,12 @@ import * as httpm from '@actions/http-client'
|
||||
import * as semver from 'semver'
|
||||
import * as stream from 'stream'
|
||||
import * as util from 'util'
|
||||
import {ok} from 'assert'
|
||||
import {OutgoingHttpHeaders} from 'http'
|
||||
import uuidV4 from 'uuid/v4'
|
||||
import {exec} from '@actions/exec/lib/exec'
|
||||
import {ExecOptions} from '@actions/exec/lib/interfaces'
|
||||
import {ok} from 'assert'
|
||||
import {RetryHelper} from './retry-helper'
|
||||
import {IHeaders} from '@actions/http-client/interfaces'
|
||||
|
||||
export class HTTPError extends Error {
|
||||
constructor(readonly httpStatusCode: number | undefined) {
|
||||
@@ -39,7 +39,7 @@ export async function downloadTool(
|
||||
url: string,
|
||||
dest?: string,
|
||||
auth?: string,
|
||||
headers?: IHeaders
|
||||
headers?: OutgoingHttpHeaders
|
||||
): Promise<string> {
|
||||
dest = dest || path.join(_getTempDirectory(), uuidV4())
|
||||
await io.mkdirP(path.dirname(dest))
|
||||
@@ -82,7 +82,7 @@ async function downloadToolAttempt(
|
||||
url: string,
|
||||
dest: string,
|
||||
auth?: string,
|
||||
headers?: IHeaders
|
||||
headers?: OutgoingHttpHeaders
|
||||
): Promise<string> {
|
||||
if (fs.existsSync(dest)) {
|
||||
throw new Error(`Destination file path ${dest} already exists`)
|
||||
@@ -596,7 +596,7 @@ export async function getManifestFromRepo(
|
||||
const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`
|
||||
|
||||
const http: httpm.HttpClient = new httpm.HttpClient('tool-cache')
|
||||
const headers: IHeaders = {}
|
||||
const headers: OutgoingHttpHeaders = {}
|
||||
if (auth) {
|
||||
core.debug('set auth')
|
||||
headers.authorization = auth
|
||||
|
||||
Reference in New Issue
Block a user