Skip to content

Commit

Permalink
Download using actions/github-script
Browse files Browse the repository at this point in the history
  • Loading branch information
matiaskorhonen committed Sep 27, 2023
1 parent a8b33a8 commit 5ebebe5
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,28 @@ jobs:
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: 'Download artifact'
uses: actions/github-script@v6
with:
name: visual-snapshots
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "visual-snapshots"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/visual-snapshots.zip', Buffer.from(download.data));
- name: Unzip artifact
run: unzip visual-snapshots.zip
- name: Display structure of downloaded files
run: ls -R
# - name: Upload to B2
Expand Down

0 comments on commit 5ebebe5

Please sign in to comment.