mirror of
https://code.forgejo.org/actions/upload-artifact.git
synced 2026-03-16 21:15:54 +03:00
Display artifact upload size in human-readable format (KB/MB)
This commit is contained in:
parent
bbbca2ddaa
commit
4563c41455
3 changed files with 28 additions and 3 deletions
10
dist/merge/index.js
vendored
10
dist/merge/index.js
vendored
|
|
@ -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
10
dist/upload/index.js
vendored
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue