1
0
Fork 0

updating deps

pull/1477/head
Vallie Joseph 2023-07-28 14:55:49 +00:00
parent 20e1b242c8
commit 522784791c
18 changed files with 138 additions and 208 deletions

View File

@ -1,8 +1,7 @@
import CRC64, {CRC64DigestEncoding} from '../src/internal/crc64' import CRC64, {CRC64DigestEncoding} from '../src/internal/crc64'
const fixtures = { const fixtures = {
data: data: '🚀 👉😎👉 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n',
'🚀 👉😎👉 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n',
expected: { expected: {
hex: '846CE4ADAD6223ED', hex: '846CE4ADAD6223ED',
base64: '7SNira3kbIQ=', base64: '7SNira3kbIQ=',

View File

@ -2,22 +2,22 @@ import * as http from 'http'
import * as io from '../../io/src/io' import * as io from '../../io/src/io'
import * as net from 'net' import * as net from 'net'
import * as path from 'path' import * as path from 'path'
import { mocked } from 'ts-jest/utils' import {mocked} from 'ts-jest/utils'
import { exec, execSync } from 'child_process' import {exec, execSync} from 'child_process'
import { createGunzip } from 'zlib' import {createGunzip} from 'zlib'
import { promisify } from 'util' import {promisify} from 'util'
import { UploadHttpClient } from '../src/internal/upload-http-client' import {UploadHttpClient} from '../src/internal/upload-http-client'
import * as core from '@actions/core' import * as core from '@actions/core'
import { promises as fs } from 'fs' import {promises as fs} from 'fs'
import { getRuntimeUrl } from '../src/internal/config-variables' import {getRuntimeUrl} from '../src/internal/config-variables'
import { HttpClient, HttpClientResponse } from '@actions/http-client' import {HttpClient, HttpClientResponse} from '@actions/http-client'
import { import {
ArtifactResponse, ArtifactResponse,
PatchArtifactSizeSuccessResponse PatchArtifactSizeSuccessResponse
} from '../src/internal/contracts' } from '../src/internal/contracts'
import { UploadSpecification } from '../src/internal/upload-specification' import {UploadSpecification} from '../src/internal/upload-specification'
import { getArtifactUrl } from '../src/internal/utils' import {getArtifactUrl} from '../src/internal/utils'
import { UploadOptions } from '../src/internal/upload-options' import {UploadOptions} from '../src/internal/upload-options'
const root = path.join(__dirname, '_temp', 'artifact-upload') const root = path.join(__dirname, '_temp', 'artifact-upload')
const file1Path = path.join(root, 'file1.txt') const file1Path = path.join(root, 'file1.txt')
@ -38,11 +38,11 @@ jest.mock('@actions/http-client')
describe('Upload Tests', () => { describe('Upload Tests', () => {
beforeAll(async () => { beforeAll(async () => {
// mock all output so that there is less noise when running tests // mock all output so that there is less noise when running tests
jest.spyOn(console, 'log').mockImplementation(() => { }) jest.spyOn(console, 'log').mockImplementation(() => {})
jest.spyOn(core, 'debug').mockImplementation(() => { }) jest.spyOn(core, 'debug').mockImplementation(() => {})
jest.spyOn(core, 'info').mockImplementation(() => { }) jest.spyOn(core, 'info').mockImplementation(() => {})
jest.spyOn(core, 'warning').mockImplementation(() => { }) jest.spyOn(core, 'warning').mockImplementation(() => {})
jest.spyOn(core, 'error').mockImplementation(() => { }) jest.spyOn(core, 'error').mockImplementation(() => {})
// setup mocking for calls that got through the HttpClient // setup mocking for calls that got through the HttpClient
setupHttpClientMock() setupHttpClientMock()
@ -196,7 +196,7 @@ describe('Upload Tests', () => {
// create a named pipe 'pipe' with content 'hello pipe' // create a named pipe 'pipe' with content 'hello pipe'
const content = Buffer.from('hello pipe') const content = Buffer.from('hello pipe')
const pipeFilePath = path.join(root, 'pipe') const pipeFilePath = path.join(root, 'pipe')
await promisify(exec)('mkfifo pipe', { cwd: root }) await promisify(exec)('mkfifo pipe', {cwd: root})
// don't want to await here as that would block until read // don't want to await here as that would block until read
fs.writeFile(pipeFilePath, content) fs.writeFile(pipeFilePath, content)
@ -280,7 +280,7 @@ describe('Upload Tests', () => {
const uploadResult = await uploadHttpClient.uploadArtifactToFileContainer( const uploadResult = await uploadHttpClient.uploadArtifactToFileContainer(
uploadUrl, uploadUrl,
uploadSpecification, uploadSpecification,
{ continueOnError: true } {continueOnError: true}
) )
expect(uploadResult.failedItems.length).toEqual(1) expect(uploadResult.failedItems.length).toEqual(1)
expect(uploadResult.uploadSize).toEqual(expectedPartialSize) expect(uploadResult.uploadSize).toEqual(expectedPartialSize)
@ -317,7 +317,7 @@ describe('Upload Tests', () => {
const uploadResult = await uploadHttpClient.uploadArtifactToFileContainer( const uploadResult = await uploadHttpClient.uploadArtifactToFileContainer(
uploadUrl, uploadUrl,
uploadSpecification, uploadSpecification,
{ continueOnError: false } {continueOnError: false}
) )
expect(uploadResult.failedItems.length).toEqual(2) expect(uploadResult.failedItems.length).toEqual(2)
expect(uploadResult.uploadSize).toEqual(expectedPartialSize) expect(uploadResult.uploadSize).toEqual(expectedPartialSize)
@ -461,8 +461,9 @@ describe('Upload Tests', () => {
fileContainerResourceUrl: `${getRuntimeUrl()}_apis/resources/Containers/13`, fileContainerResourceUrl: `${getRuntimeUrl()}_apis/resources/Containers/13`,
type: 'actions_storage', type: 'actions_storage',
name: inputData.Name, name: inputData.Name,
url: `${getRuntimeUrl()}_apis/pipelines/1/runs/1/artifacts?artifactName=${inputData.Name url: `${getRuntimeUrl()}_apis/pipelines/1/runs/1/artifacts?artifactName=${
}` inputData.Name
}`
} }
const returnData: string = JSON.stringify(response, null, 2) const returnData: string = JSON.stringify(response, null, 2)
mockReadBody = async function (): Promise<string> { mockReadBody = async function (): Promise<string> {

View File

@ -29,9 +29,8 @@ describe('Utils', () => {
expect(retryWaitTime0).toEqual(getInitialRetryIntervalInMilliseconds()) expect(retryWaitTime0).toEqual(getInitialRetryIntervalInMilliseconds())
const testMinMaxRange = (retryCount: number): void => { const testMinMaxRange = (retryCount: number): void => {
const retryWaitTime = utils.getExponentialRetryTimeInMilliseconds( const retryWaitTime =
retryCount utils.getExponentialRetryTimeInMilliseconds(retryCount)
)
const minRange = const minRange =
getInitialRetryIntervalInMilliseconds() * getInitialRetryIntervalInMilliseconds() *
getRetryMultiplier() * getRetryMultiplier() *

View File

@ -14,16 +14,16 @@ import {
rmFile, rmFile,
sleep sleep
} from './utils' } from './utils'
import { URL } from 'url' import {URL} from 'url'
import { StatusReporter } from './status-reporter' import {StatusReporter} from './status-reporter'
import { performance } from 'perf_hooks' import {performance} from 'perf_hooks'
import { ListArtifactsResponse, QueryArtifactResponse } from './contracts' import {ListArtifactsResponse, QueryArtifactResponse} from './contracts'
import { HttpClientResponse } from '@actions/http-client' import {HttpClientResponse} from '@actions/http-client'
import { HttpManager } from './http-manager' import {HttpManager} from './http-manager'
import { DownloadItem } from './download-specification' import {DownloadItem} from './download-specification'
import { getDownloadFileConcurrency, getRetryLimit } from './config-variables' import {getDownloadFileConcurrency, getRetryLimit} from './config-variables'
import { IncomingHttpHeaders } from 'http' import {IncomingHttpHeaders} from 'http'
import { retryHttpClientRequest } from './requestUtils' import {retryHttpClientRequest} from './requestUtils'
export class DownloadHttpClient { export class DownloadHttpClient {
// http manager is used for concurrent connections when downloading multiple files at once // http manager is used for concurrent connections when downloading multiple files at once
@ -113,7 +113,8 @@ export class DownloadHttpClient {
if (core.isDebug()) { if (core.isDebug()) {
core.debug( core.debug(
`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath `File: ${++downloadedFiles}/${downloadItems.length}. ${
currentFileToDownload.targetPath
} took ${(performance.now() - startTime).toFixed( } took ${(performance.now() - startTime).toFixed(
3 3
)} milliseconds to finish downloading` )} milliseconds to finish downloading`
@ -279,8 +280,8 @@ export class DownloadHttpClient {
// if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
isThrottledStatusCode(response.message.statusCode) isThrottledStatusCode(response.message.statusCode)
? await backOff( ? await backOff(
tryGetRetryAfterValueTimeInMilliseconds(response.message.headers) tryGetRetryAfterValueTimeInMilliseconds(response.message.headers)
) )
: await backOff() : await backOff()
} else { } else {
// Some unexpected response code, fail immediately and stop the download // Some unexpected response code, fail immediately and stop the download

85
packages/cache/package-lock.json generated vendored
View File

@ -248,15 +248,14 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}, },
"node_modules/@azure/ms-rest-js": { "node_modules/@azure/ms-rest-js": {
"version": "2.6.6", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.6.tgz", "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.7.0.tgz",
"integrity": "sha512-WYIda8VvrkZE68xHgOxUXvjThxNf1nnGPPe0rAljqK5HJHIZ12Pi3YhEDOn3Ge7UnwaaM3eFO0VtAy4nGVI27Q==", "integrity": "sha512-ngbzWbqF+NmztDOpLBVDxYM+XLcUj7nKhxGbSU9WtIsXfRB//cf2ZbAG5HkOrhU9/wd/ORRB6lM/d69RKVjiyA==",
"dependencies": { "dependencies": {
"@azure/core-auth": "^1.1.4", "@azure/core-auth": "^1.1.4",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^2.5.0", "form-data": "^2.5.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"tough-cookie": "^3.0.1",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"tunnel": "0.0.6", "tunnel": "0.0.6",
"uuid": "^8.3.2", "uuid": "^8.3.2",
@ -432,14 +431,6 @@
"node": ">= 0.12" "node": ">= 0.12"
} }
}, },
"node_modules/ip-regex": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",
"integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=",
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": { "node_modules/mime-db": {
"version": "1.51.0", "version": "1.51.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
@ -497,45 +488,19 @@
"node": ">= 0.6.0" "node": ">= 0.6.0"
} }
}, },
"node_modules/psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
},
"node_modules/punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"engines": {
"node": ">=6"
}
},
"node_modules/sax": { "node_modules/sax": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "6.3.0", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
} }
}, },
"node_modules/tough-cookie": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
"integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
"dependencies": {
"ip-regex": "^2.1.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
},
"engines": {
"node": ">=6"
}
},
"node_modules/tr46": { "node_modules/tr46": {
"version": "0.0.3", "version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@ -819,15 +784,14 @@
} }
}, },
"@azure/ms-rest-js": { "@azure/ms-rest-js": {
"version": "2.6.6", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.6.tgz", "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.7.0.tgz",
"integrity": "sha512-WYIda8VvrkZE68xHgOxUXvjThxNf1nnGPPe0rAljqK5HJHIZ12Pi3YhEDOn3Ge7UnwaaM3eFO0VtAy4nGVI27Q==", "integrity": "sha512-ngbzWbqF+NmztDOpLBVDxYM+XLcUj7nKhxGbSU9WtIsXfRB//cf2ZbAG5HkOrhU9/wd/ORRB6lM/d69RKVjiyA==",
"requires": { "requires": {
"@azure/core-auth": "^1.1.4", "@azure/core-auth": "^1.1.4",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^2.5.0", "form-data": "^2.5.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"tough-cookie": "^3.0.1",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"tunnel": "0.0.6", "tunnel": "0.0.6",
"uuid": "^8.3.2", "uuid": "^8.3.2",
@ -979,11 +943,6 @@
"mime-types": "^2.1.12" "mime-types": "^2.1.12"
} }
}, },
"ip-regex": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",
"integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk="
},
"mime-db": { "mime-db": {
"version": "1.51.0", "version": "1.51.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
@ -1018,35 +977,15 @@
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
}, },
"psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"sax": { "sax": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
}, },
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
},
"tough-cookie": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
"integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
"requires": {
"ip-regex": "^2.1.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
}
}, },
"tr46": { "tr46": {
"version": "0.0.3", "version": "0.0.3",

View File

@ -92,10 +92,7 @@ export function getCacheVersion(
// Add salt to cache version to support breaking changes in cache entry // Add salt to cache version to support breaking changes in cache entry
components.push(versionSalt) components.push(versionSalt)
return crypto return crypto.createHash('sha256').update(components.join('|')).digest('hex')
.createHash('sha256')
.update(components.join('|'))
.digest('hex')
} }
export async function getCacheEntry( export async function getCacheEntry(
@ -230,9 +227,9 @@ async function uploadChunk(
end: number end: number
): Promise<void> { ): Promise<void> {
core.debug( core.debug(
`Uploading chunk of size ${end - `Uploading chunk of size ${
start + end - start + 1
1} bytes at offset ${start} with content range: ${getContentRange( } bytes at offset ${start} with content range: ${getContentRange(
start, start,
end end
)}` )}`

View File

@ -17,7 +17,7 @@ describe('@actions/core/src/command', () => {
afterEach(() => {}) afterEach(() => {})
afterAll(() => { afterAll(() => {
process.stdout.write = (originalWriteFunction as unknown) as ( process.stdout.write = originalWriteFunction as unknown as (
str: string str: string
) => boolean ) => boolean
}) })
@ -51,8 +51,7 @@ describe('@actions/core/src/command', () => {
command.issueCommand( command.issueCommand(
'some-command', 'some-command',
{ {
name: name: 'percent % percent % cr \r cr \r lf \n lf \n colon : colon : comma , comma ,'
'percent % percent % cr \r cr \r lf \n lf \n colon : colon : comma , comma ,'
}, },
'' ''
) )
@ -117,11 +116,11 @@ describe('@actions/core/src/command', () => {
command.issueCommand( command.issueCommand(
'some-command', 'some-command',
{ {
prop1: ({test: 'object'} as unknown) as string, prop1: {test: 'object'} as unknown as string,
prop2: (123 as unknown) as string, prop2: 123 as unknown as string,
prop3: (true as unknown) as string prop3: true as unknown as string
}, },
({test: 'object'} as unknown) as string {test: 'object'} as unknown as string
) )
assertWriteCalls([ assertWriteCalls([
`::some-command prop1={"test"%3A"object"},prop2=123,prop3=true::{"test":"object"}${os.EOL}` `::some-command prop1={"test"%3A"object"},prop2=123,prop3=true::{"test":"object"}${os.EOL}`

View File

@ -150,10 +150,7 @@ describe('@actions/core/src/summary', () => {
}) })
it('adds EOL', async () => { it('adds EOL', async () => {
await summary await summary.addRaw(fixtures.text).addEOL().write()
.addRaw(fixtures.text)
.addEOL()
.write()
await assertSummary(fixtures.text + os.EOL) await assertSummary(fixtures.text + os.EOL)
}) })

View File

@ -267,10 +267,7 @@ export class ToolRunner extends events.EventEmitter {
} }
reverse += '"' reverse += '"'
return reverse return reverse.split('').reverse().join('')
.split('')
.reverse()
.join('')
} }
private _uvQuoteCmdArg(arg: string): string { private _uvQuoteCmdArg(arg: string): string {
@ -350,10 +347,7 @@ export class ToolRunner extends events.EventEmitter {
} }
reverse += '"' reverse += '"'
return reverse return reverse.split('').reverse().join('')
.split('')
.reverse()
.join('')
} }
private _cloneExecOptions(options?: im.ExecOptions): im.ExecOptions { private _cloneExecOptions(options?: im.ExecOptions): im.ExecOptions {
@ -691,8 +685,9 @@ class ExecState extends events.EventEmitter {
} }
if (!state.processClosed && state.processExited) { if (!state.processClosed && state.processExited) {
const message = `The STDIO streams did not close within ${state.delay / const message = `The STDIO streams did not close within ${
1000} seconds of the exit event from process '${ state.delay / 1000
} seconds of the exit event from process '${
state.toolPath state.toolPath
}'. This may indicate a child process inherited the STDIO streams and has not yet exited.` }'. This may indicate a child process inherited the STDIO streams and has not yet exited.`
state._debug(message) state._debug(message)

View File

@ -36,6 +36,14 @@
"uuid": "^8.3.2" "uuid": "^8.3.2"
} }
}, },
"node_modules/@actions/http-client": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz",
"integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==",
"dependencies": {
"tunnel": "^0.0.6"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@ -65,6 +73,22 @@
"engines": { "engines": {
"node": "*" "node": "*"
} }
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
} }
}, },
"bugs": { "bugs": {

View File

@ -31,9 +31,8 @@ describe('auth', () => {
it('does basic http get request with pat token auth', async () => { it('does basic http get request with pat token auth', async () => {
const token = 'scbfb44vxzku5l4xgc3qfazn3lpk4awflfryc76esaiq7aypcbhs' const token = 'scbfb44vxzku5l4xgc3qfazn3lpk4awflfryc76esaiq7aypcbhs'
const ph: am.PersonalAccessTokenCredentialHandler = new am.PersonalAccessTokenCredentialHandler( const ph: am.PersonalAccessTokenCredentialHandler =
token new am.PersonalAccessTokenCredentialHandler(token)
)
const http: httpm.HttpClient = new httpm.HttpClient('http-client-tests', [ const http: httpm.HttpClient = new httpm.HttpClient('http-client-tests', [
ph ph

View File

@ -1,12 +1,12 @@
{ {
"name": "@actions/http-client", "name": "@actions/http-client",
"version": "2.0.1", "version": "2.1.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@actions/http-client", "name": "@actions/http-client",
"version": "2.0.1", "version": "2.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tunnel": "^0.0.6" "tunnel": "^0.0.6"

View File

@ -57,7 +57,8 @@ export class BearerCredentialHandler implements ifm.RequestHandler {
} }
export class PersonalAccessTokenCredentialHandler export class PersonalAccessTokenCredentialHandler
implements ifm.RequestHandler { implements ifm.RequestHandler
{
token: string token: string
constructor(token: string) { constructor(token: string) {

View File

@ -519,7 +519,7 @@ export class HttpClient {
handleResult(new Error(`Request timeout: ${info.options.path}`)) handleResult(new Error(`Request timeout: ${info.options.path}`))
}) })
req.on('error', function(err) { req.on('error', function (err) {
// err has statusCode property // err has statusCode property
// res should have headers // res should have headers
handleResult(err) handleResult(err)
@ -530,7 +530,7 @@ export class HttpClient {
} }
if (data && typeof data !== 'string') { if (data && typeof data !== 'string') {
data.on('close', function() { data.on('close', function () {
req.end() req.end()
}) })

View File

@ -68,7 +68,7 @@ describe('retry-helper tests', () => {
it('all attempts fail', async () => { it('all attempts fail', async () => {
let attempts = 0 let attempts = 0
let error: Error = (null as unknown) as Error let error: Error = null as unknown as Error
try { try {
await retryHelper.execute(() => { await retryHelper.execute(() => {
throw new Error(`some error ${++attempts}`) throw new Error(`some error ${++attempts}`)
@ -87,7 +87,7 @@ describe('retry-helper tests', () => {
it('checks retryable after first attempt', async () => { it('checks retryable after first attempt', async () => {
let attempts = 0 let attempts = 0
let error: Error = (null as unknown) as Error let error: Error = null as unknown as Error
try { try {
await retryHelper.execute( await retryHelper.execute(
async () => { async () => {
@ -105,7 +105,7 @@ describe('retry-helper tests', () => {
it('checks retryable after second attempt', async () => { it('checks retryable after second attempt', async () => {
let attempts = 0 let attempts = 0
let error: Error = (null as unknown) as Error let error: Error = null as unknown as Error
try { try {
await retryHelper.execute( await retryHelper.execute(
async () => { async () => {

View File

@ -17,31 +17,28 @@ import * as tc from '../src/tool-cache'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
const IS_MAC = process.platform === 'darwin' const IS_MAC = process.platform === 'darwin'
describe('@actions/tool-cache', function() { describe('@actions/tool-cache', function () {
beforeAll(function() { beforeAll(function () {
nock('http://example.com') nock('http://example.com').persist().get('/bytes/35').reply(200, {
.persist() username: 'abc',
.get('/bytes/35') password: 'def'
.reply(200, { })
username: 'abc',
password: 'def'
})
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 0) setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 0)
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 0) setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 0)
}) })
beforeEach(async function() { beforeEach(async function () {
await io.rmRF(cachePath) await io.rmRF(cachePath)
await io.rmRF(tempPath) await io.rmRF(tempPath)
await io.mkdirP(cachePath) await io.mkdirP(cachePath)
await io.mkdirP(tempPath) await io.mkdirP(tempPath)
}) })
afterEach(function() { afterEach(function () {
setResponseMessageFactory(undefined) setResponseMessageFactory(undefined)
}) })
afterAll(async function() { afterAll(async function () {
await io.rmRF(tempPath) await io.rmRF(tempPath)
await io.rmRF(cachePath) await io.rmRF(cachePath)
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', undefined) setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', undefined)
@ -177,13 +174,10 @@ describe('@actions/tool-cache', function() {
}) })
it('has status code in exception dictionary for HTTP error code responses', async () => { it('has status code in exception dictionary for HTTP error code responses', async () => {
nock('http://example.com') nock('http://example.com').persist().get('/bytes/bad').reply(400, {
.persist() username: 'bad',
.get('/bytes/bad') password: 'file'
.reply(400, { })
username: 'bad',
password: 'file'
})
expect.assertions(2) expect.assertions(2)
@ -196,7 +190,7 @@ describe('@actions/tool-cache', function() {
} }
}) })
it('works with redirect code 302', async function() { it('works with redirect code 302', async function () {
nock('http://example.com') nock('http://example.com')
.persist() .persist()
.get('/redirect-to') .get('/redirect-to')
@ -295,7 +289,7 @@ describe('@actions/tool-cache', function() {
} }
}) })
it('extract 7z using custom 7z tool', async function() { it('extract 7z using custom 7z tool', async function () {
const tempDir = path.join( const tempDir = path.join(
__dirname, __dirname,
'test-extract-7z-using-custom-7z-tool' 'test-extract-7z-using-custom-7z-tool'
@ -643,7 +637,7 @@ describe('@actions/tool-cache', function() {
} }
) )
it('installs a zip and extracts it to specified directory', async function() { it('installs a zip and extracts it to specified directory', async function () {
const tempDir = path.join(__dirname, 'test-install-zip') const tempDir = path.join(__dirname, 'test-install-zip')
try { try {
await io.mkdirP(tempDir) await io.mkdirP(tempDir)
@ -706,7 +700,7 @@ describe('@actions/tool-cache', function() {
} }
}) })
it('extract zip to a directory that does not exist', async function() { it('extract zip to a directory that does not exist', async function () {
const tempDir = path.join(__dirname, 'test-install-zip') const tempDir = path.join(__dirname, 'test-install-zip')
try { try {
await io.mkdirP(tempDir) await io.mkdirP(tempDir)
@ -762,24 +756,16 @@ describe('@actions/tool-cache', function() {
} }
}) })
it('works with a 502 temporary failure', async function() { it('works with a 502 temporary failure', async function () {
nock('http://example.com') nock('http://example.com').get('/temp502').twice().reply(502, undefined)
.get('/temp502') nock('http://example.com').get('/temp502').reply(200, undefined)
.twice()
.reply(502, undefined)
nock('http://example.com')
.get('/temp502')
.reply(200, undefined)
const statusCodeUrl = 'http://example.com/temp502' const statusCodeUrl = 'http://example.com/temp502'
await tc.downloadTool(statusCodeUrl) await tc.downloadTool(statusCodeUrl)
}) })
it("doesn't retry 502s more than 3 times", async function() { it("doesn't retry 502s more than 3 times", async function () {
nock('http://example.com') nock('http://example.com').get('/perm502').times(3).reply(502, undefined)
.get('/perm502')
.times(3)
.reply(502, undefined)
expect.assertions(1) expect.assertions(1)
@ -791,7 +777,7 @@ describe('@actions/tool-cache', function() {
} }
}) })
it('retries 429s', async function() { it('retries 429s', async function () {
nock('http://example.com') nock('http://example.com')
.get('/too-many-requests-429') .get('/too-many-requests-429')
.times(2) .times(2)
@ -808,13 +794,9 @@ describe('@actions/tool-cache', function() {
} }
}) })
it("doesn't retry 404", async function() { it("doesn't retry 404", async function () {
nock('http://example.com') nock('http://example.com').get('/not-found-404').reply(404, undefined)
.get('/not-found-404') nock('http://example.com').get('/not-found-404').reply(500, undefined)
.reply(404, undefined)
nock('http://example.com')
.get('/not-found-404')
.reply(500, undefined)
try { try {
const statusCodeUrl = 'http://example.com/not-found-404' const statusCodeUrl = 'http://example.com/not-found-404'
@ -824,7 +806,7 @@ describe('@actions/tool-cache', function() {
} }
}) })
it('supports authorization headers', async function() { it('supports authorization headers', async function () {
nock('http://example.com', { nock('http://example.com', {
reqheaders: { reqheaders: {
authorization: 'token abc123' authorization: 'token abc123'
@ -840,7 +822,7 @@ describe('@actions/tool-cache', function() {
) )
}) })
it('supports custom headers', async function() { it('supports custom headers', async function () {
nock('http://example.com', { nock('http://example.com', {
reqheaders: { reqheaders: {
accept: 'application/octet-stream' accept: 'application/octet-stream'
@ -859,7 +841,7 @@ describe('@actions/tool-cache', function() {
) )
}) })
it('supports authorization and custom headers', async function() { it('supports authorization and custom headers', async function () {
nock('http://example.com', { nock('http://example.com', {
reqheaders: { reqheaders: {
accept: 'application/octet-stream', accept: 'application/octet-stream',

View File

@ -145,9 +145,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "6.3.0", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
} }
@ -284,9 +284,9 @@
"dev": true "dev": true
}, },
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}, },
"tunnel": { "tunnel": {
"version": "0.0.6", "version": "0.0.6",

View File

@ -140,10 +140,7 @@ export function _getOsVersion(): string {
(parts[0].trim() === 'VERSION_ID' || (parts[0].trim() === 'VERSION_ID' ||
parts[0].trim() === 'DISTRIB_RELEASE') parts[0].trim() === 'DISTRIB_RELEASE')
) { ) {
version = parts[1] version = parts[1].trim().replace(/^"/, '').replace(/"$/, '')
.trim()
.replace(/^"/, '')
.replace(/"$/, '')
break break
} }
} }