Skip to content

Commit

Permalink
feat: use download action
Browse files Browse the repository at this point in the history
  • Loading branch information
aksmo committed Mar 6, 2024
1 parent 8e50506 commit ec35f20
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/unit-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,12 @@ jobs:
github.event.workflow_run.conclusion != 'skipped'
steps:
- name: Download Artifacts
uses: actions/github-script@v7
- name: Download package
uses: actions/download-artifact@v4
with:
script: |
var fs = require('fs');
var path = require('path');
var artifacts_path = path.join('${{github.workspace}}', 'artifacts')
fs.mkdirSync(artifacts_path, { recursive: true })
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
for (const artifact of artifacts.data.artifacts) {
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
var artifact_path = path.join(artifacts_path, `${artifact.name}.zip`)
fs.writeFileSync(artifact_path, Buffer.from(download.data));
console.log(`Downloaded ${artifact_path}`);
}
name: Unit Test Results
path: ./artifacts

- name: Extract Artifacts
run: |
for file in artifacts/*.zip
Expand Down

0 comments on commit ec35f20

Please sign in to comment.