1
0
Fork 0

return artifact digest on upload

Signed-off-by: Brian DeHamer <bdehamer@github.com>
pull/1896/head
Brian DeHamer 2024-12-06 14:27:02 -08:00
parent b7a00a3203
commit 1e0c16f0dc
No known key found for this signature in database
3 changed files with 9 additions and 1 deletions

View File

@ -281,7 +281,7 @@ describe('upload-artifact', () => {
}
)
const {id, size} = await uploadArtifact(
const {id, size, digest} = await uploadArtifact(
fixtures.inputs.artifactName,
fixtures.files.map(file =>
path.join(fixtures.uploadDirectory, file.name)
@ -291,6 +291,8 @@ describe('upload-artifact', () => {
expect(id).toBe(1)
expect(size).toBe(loadedBytes)
expect(digest).toBeDefined()
expect(digest).toHaveLength(64)
const extractedDirectory = path.join(
fixtures.uploadDirectory,

View File

@ -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
*/
id?: number
/**
* The SHA256 digest of the artifact that was created. Not provided if no artifact was uploaded
*/
digest?: string
}
/**

View File

@ -110,6 +110,7 @@ export async function uploadArtifact(
return {
size: uploadResult.uploadSize,
digest: uploadResult.sha256Hash,
id: Number(artifactId)
}
}