mirror of https://github.com/actions/toolkit
Merge pull request #1896 from actions/bdehamer/artifact-digest
return artifact digest on uploadpull/1908/head
commit
f522fdf89d
|
@ -281,7 +281,7 @@ describe('upload-artifact', () => {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const {id, size} = await uploadArtifact(
|
const {id, size, digest} = await uploadArtifact(
|
||||||
fixtures.inputs.artifactName,
|
fixtures.inputs.artifactName,
|
||||||
fixtures.files.map(file =>
|
fixtures.files.map(file =>
|
||||||
path.join(fixtures.uploadDirectory, file.name)
|
path.join(fixtures.uploadDirectory, file.name)
|
||||||
|
@ -291,6 +291,8 @@ describe('upload-artifact', () => {
|
||||||
|
|
||||||
expect(id).toBe(1)
|
expect(id).toBe(1)
|
||||||
expect(size).toBe(loadedBytes)
|
expect(size).toBe(loadedBytes)
|
||||||
|
expect(digest).toBeDefined()
|
||||||
|
expect(digest).toHaveLength(64)
|
||||||
|
|
||||||
const extractedDirectory = path.join(
|
const extractedDirectory = path.join(
|
||||||
fixtures.uploadDirectory,
|
fixtures.uploadDirectory,
|
||||||
|
|
|
@ -12,6 +12,11 @@ export interface UploadArtifactResponse {
|
||||||
* This ID can be used as input to other APIs to download, delete or get more information about an artifact: https://docs.github.com/en/rest/actions/artifacts
|
* This ID can be used as input to other APIs to download, delete or get more information about an artifact: https://docs.github.com/en/rest/actions/artifacts
|
||||||
*/
|
*/
|
||||||
id?: number
|
id?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SHA256 digest of the artifact that was created. Not provided if no artifact was uploaded
|
||||||
|
*/
|
||||||
|
digest?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,6 +110,7 @@ export async function uploadArtifact(
|
||||||
|
|
||||||
return {
|
return {
|
||||||
size: uploadResult.uploadSize,
|
size: uploadResult.uploadSize,
|
||||||
|
digest: uploadResult.sha256Hash,
|
||||||
id: Number(artifactId)
|
id: Number(artifactId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue