mirror of https://github.com/actions/toolkit
prettier
parent
03a876f0a7
commit
3b44a4cc23
|
@ -47,12 +47,10 @@ describe('upload-artifact', () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(zip, 'createZipUploadStream')
|
.spyOn(zip, 'createZipUploadStream')
|
||||||
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
||||||
jest
|
jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
|
||||||
.spyOn(util, 'getBackendIdsFromToken')
|
workflowRunBackendId: '1234',
|
||||||
.mockReturnValue({
|
workflowJobRunBackendId: '5678'
|
||||||
workflowRunBackendId: '1234',
|
})
|
||||||
workflowJobRunBackendId: '5678'
|
|
||||||
})
|
|
||||||
jest
|
jest
|
||||||
.spyOn(retention, 'getExpiration')
|
.spyOn(retention, 'getExpiration')
|
||||||
.mockReturnValue(Timestamp.fromDate(mockDate))
|
.mockReturnValue(Timestamp.fromDate(mockDate))
|
||||||
|
@ -64,15 +62,13 @@ describe('upload-artifact', () => {
|
||||||
signedUploadUrl: 'https://signed-upload-url.com'
|
signedUploadUrl: 'https://signed-upload-url.com'
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
jest
|
jest.spyOn(blobUpload, 'uploadZipToBlobStorage').mockReturnValue(
|
||||||
.spyOn(blobUpload, 'uploadZipToBlobStorage')
|
Promise.resolve({
|
||||||
.mockReturnValue(
|
isSuccess: true,
|
||||||
Promise.resolve({
|
uploadSize: 1234,
|
||||||
isSuccess: true,
|
md5Hash: 'test-md5-hash'
|
||||||
uploadSize: 1234,
|
})
|
||||||
md5Hash: 'test-md5-hash'
|
)
|
||||||
})
|
|
||||||
)
|
|
||||||
jest
|
jest
|
||||||
.spyOn(ArtifactServiceClientJSON.prototype, 'FinalizeArtifact')
|
.spyOn(ArtifactServiceClientJSON.prototype, 'FinalizeArtifact')
|
||||||
.mockReturnValue(Promise.resolve({ok: true, artifactId: '1'}))
|
.mockReturnValue(Promise.resolve({ok: true, artifactId: '1'}))
|
||||||
|
@ -202,12 +198,10 @@ describe('upload-artifact', () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(zip, 'createZipUploadStream')
|
.spyOn(zip, 'createZipUploadStream')
|
||||||
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
||||||
jest
|
jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
|
||||||
.spyOn(util, 'getBackendIdsFromToken')
|
workflowRunBackendId: '1234',
|
||||||
.mockReturnValue({
|
workflowJobRunBackendId: '5678'
|
||||||
workflowRunBackendId: '1234',
|
})
|
||||||
workflowJobRunBackendId: '5678'
|
|
||||||
})
|
|
||||||
jest
|
jest
|
||||||
.spyOn(retention, 'getExpiration')
|
.spyOn(retention, 'getExpiration')
|
||||||
.mockReturnValue(Timestamp.fromDate(mockDate))
|
.mockReturnValue(Timestamp.fromDate(mockDate))
|
||||||
|
@ -259,12 +253,10 @@ describe('upload-artifact', () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(zip, 'createZipUploadStream')
|
.spyOn(zip, 'createZipUploadStream')
|
||||||
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
||||||
jest
|
jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
|
||||||
.spyOn(util, 'getBackendIdsFromToken')
|
workflowRunBackendId: '1234',
|
||||||
.mockReturnValue({
|
workflowJobRunBackendId: '5678'
|
||||||
workflowRunBackendId: '1234',
|
})
|
||||||
workflowJobRunBackendId: '5678'
|
|
||||||
})
|
|
||||||
jest
|
jest
|
||||||
.spyOn(retention, 'getExpiration')
|
.spyOn(retention, 'getExpiration')
|
||||||
.mockReturnValue(Timestamp.fromDate(mockDate))
|
.mockReturnValue(Timestamp.fromDate(mockDate))
|
||||||
|
@ -324,12 +316,10 @@ describe('upload-artifact', () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(zip, 'createZipUploadStream')
|
.spyOn(zip, 'createZipUploadStream')
|
||||||
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
|
||||||
jest
|
jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
|
||||||
.spyOn(util, 'getBackendIdsFromToken')
|
workflowRunBackendId: '1234',
|
||||||
.mockReturnValue({
|
workflowJobRunBackendId: '5678'
|
||||||
workflowRunBackendId: '1234',
|
})
|
||||||
workflowJobRunBackendId: '5678'
|
|
||||||
})
|
|
||||||
jest
|
jest
|
||||||
.spyOn(retention, 'getExpiration')
|
.spyOn(retention, 'getExpiration')
|
||||||
.mockReturnValue(Timestamp.fromDate(mockDate))
|
.mockReturnValue(Timestamp.fromDate(mockDate))
|
||||||
|
@ -341,15 +331,13 @@ describe('upload-artifact', () => {
|
||||||
signedUploadUrl: 'https://signed-upload-url.com'
|
signedUploadUrl: 'https://signed-upload-url.com'
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
jest
|
jest.spyOn(blobUpload, 'uploadZipToBlobStorage').mockReturnValue(
|
||||||
.spyOn(blobUpload, 'uploadZipToBlobStorage')
|
Promise.resolve({
|
||||||
.mockReturnValue(
|
isSuccess: true,
|
||||||
Promise.resolve({
|
uploadSize: 1234,
|
||||||
isSuccess: true,
|
md5Hash: 'test-md5-hash'
|
||||||
uploadSize: 1234,
|
})
|
||||||
md5Hash: 'test-md5-hash'
|
)
|
||||||
})
|
|
||||||
)
|
|
||||||
jest
|
jest
|
||||||
.spyOn(ArtifactServiceClientJSON.prototype, 'FinalizeArtifact')
|
.spyOn(ArtifactServiceClientJSON.prototype, 'FinalizeArtifact')
|
||||||
.mockReturnValue(Promise.resolve({ok: false, artifactId: ''}))
|
.mockReturnValue(Promise.resolve({ok: false, artifactId: ''}))
|
||||||
|
|
|
@ -61,7 +61,9 @@ export async function downloadArtifact(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(await exists(downloadPath))) {
|
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})
|
await fs.mkdir(downloadPath, {recursive: true})
|
||||||
} else {
|
} else {
|
||||||
core.debug(`Artifact destination folder already exists: ${downloadPath}`)
|
core.debug(`Artifact destination folder already exists: ${downloadPath}`)
|
||||||
|
|
|
@ -29,7 +29,9 @@ export async function listArtifacts(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
token: string
|
token: string
|
||||||
): Promise<ListArtifactsResponse> {
|
): Promise<ListArtifactsResponse> {
|
||||||
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 artifacts: Artifact[] = []
|
||||||
const [retryOpts, requestOpts] = getRetryOptions(
|
const [retryOpts, requestOpts] = getRetryOptions(
|
||||||
|
|
Loading…
Reference in New Issue