Compressed size for `tests 1` blob report is 19Mb whil uncompressed one is 211Mb. Also according to [GitHub policy](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts ) it is uncompressed size that is used for billing: "Artifacts are uploaded during a workflow run, and you can view an artifact's name and size in the UI. When an artifact is downloaded using the GitHub UI, all files that were individually uploaded as part of the artifact get zipped together into a single file. This means that billing is calculated based on the size of the uploaded artifact and not the size of the zip file."
41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
name: 'Download artifact'
|
|
description: 'Download artifact from GitHub'
|
|
inputs:
|
|
name:
|
|
description: 'Name of the artifact to download'
|
|
required: true
|
|
type: string
|
|
default: 'blob-report'
|
|
path:
|
|
description: 'Directory with downloaded artifacts'
|
|
required: true
|
|
type: string
|
|
default: '.'
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
console.log(`downloading artifacts for workflow_run: ${context.payload.workflow_run.id}`);
|
|
console.log(`workflow_run: ${JSON.stringify(context.payload.workflow_run, null, 2)}`);
|
|
const { data } = await github.rest.actions.listWorkflowRunArtifacts({
|
|
...context.repo,
|
|
run_id: context.payload.workflow_run.id
|
|
});
|
|
console.log('total = ', data.total_count);
|
|
const name = '${{ inputs.name }}';
|
|
const report = data.artifacts.filter(a => a.name === name)[0];
|
|
const result = await github.rest.actions.downloadArtifact({
|
|
...context.repo,
|
|
artifact_id: report.id,
|
|
archive_format: 'zip'
|
|
});
|
|
console.log('download result', result);
|
|
const fs = require('fs');
|
|
fs.writeFileSync(`${name}.zip`, Buffer.from(result.data));
|
|
- name: Unzip artifact
|
|
shell: bash
|
|
run: unzip ${{ inputs.name }}.zip -d ${{ inputs.path }}
|