Display artifact upload size in human-readable format (KB/MB)

This commit is contained in:
Thomas Deegan 2026-03-10 16:20:15 -07:00
parent bbbca2ddaa
commit 4563c41455
3 changed files with 28 additions and 3 deletions

10
dist/merge/index.js vendored
View file

@ -131843,7 +131843,15 @@ function getInputs() {
async function upload_artifact_uploadArtifact(artifactName, filesToUpload, rootDirectory, options) {
const uploadResponse = await lib_artifact.uploadArtifact(artifactName, filesToUpload, rootDirectory, options);
info(`Artifact ${artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`);
const size = uploadResponse.size;
const displaySize = size === undefined
? 'unknown'
: size >= 1024 * 1024
? `${(size / (1024 * 1024)).toFixed(2)} MB`
: size >= 1024
? `${(size / 1024).toFixed(2)} KB`
: `${size} bytes`;
info(`Artifact ${artifactName} has been successfully uploaded! Final size is ${displaySize}. Artifact ID is ${uploadResponse.id}`);
setOutput('artifact-id', uploadResponse.id);
setOutput('artifact-digest', uploadResponse.digest);
const repository = github_context.repo;

10
dist/upload/index.js vendored
View file

@ -130526,7 +130526,15 @@ function getInputs() {
async function upload_artifact_uploadArtifact(artifactName, filesToUpload, rootDirectory, options) {
const uploadResponse = await artifact.uploadArtifact(artifactName, filesToUpload, rootDirectory, options);
info(`Artifact ${artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`);
const size = uploadResponse.size;
const displaySize = size === undefined
? 'unknown'
: size >= 1024 * 1024
? `${(size / (1024 * 1024)).toFixed(2)} MB`
: size >= 1024
? `${(size / 1024).toFixed(2)} KB`
: `${size} bytes`;
info(`Artifact ${artifactName} has been successfully uploaded! Final size is ${displaySize}. Artifact ID is ${uploadResponse.id}`);
setOutput('artifact-id', uploadResponse.id);
setOutput('artifact-digest', uploadResponse.digest);
const repository = github_context.repo;

View file

@ -15,8 +15,17 @@ export async function uploadArtifact(
options
)
const size = uploadResponse.size
const displaySize =
size === undefined
? 'unknown'
: size >= 1024 * 1024
? `${(size / (1024 * 1024)).toFixed(2)} MB`
: size >= 1024
? `${(size / 1024).toFixed(2)} KB`
: `${size} bytes`
core.info(
`Artifact ${artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
`Artifact ${artifactName} has been successfully uploaded! Final size is ${displaySize}. Artifact ID is ${uploadResponse.id}`
)
core.setOutput('artifact-id', uploadResponse.id)
core.setOutput('artifact-digest', uploadResponse.digest)