@@ -25,12 +25,10 @@ jobs:
25
25
with :
26
26
script : |
27
27
const { owner, repo } = context.repo;
28
- const listArtifactsResponse = await github.rest.actions.listWorkflowRunArtifacts({
29
- owner,
30
- repo,
31
- run_id: ${{ github.event.workflow_run.id }},
32
- name: 'result',
33
- });
28
+ const run_id = ${{ github.event.workflow_run.id }};
29
+ const listArtifactsQuery = { owner, repo, run_id, name: 'result' };
30
+ const listArtifactsResponse =
31
+ await github.rest.actions.listWorkflowRunArtifacts(listArtifactsQuery);
34
32
const { total_count, artifacts } = listArtifactsResponse.data;
35
33
if (total_count !== 1) {
36
34
const summary = artifacts?.map(artifact => {
@@ -40,15 +38,14 @@ jobs:
40
38
const repr = value => JSON.stringify(value);
41
39
throw Error(`Expected 1 artifact, got ${total_count} ${repr(summary ?? [])}`);
42
40
}
43
- const artifactData = {
41
+ const downloadResponse = await github.rest.actions.downloadArtifact( {
44
42
owner,
45
43
repo,
46
44
artifact_id: artifacts[0].id,
47
45
archive_format: 'zip',
48
- };
49
- const download = await github.actions.downloadArtifact(artifactData);
46
+ });
50
47
const fs = require('fs');
51
- fs.writeFileSync('${{ github.workspace }}/result.zip', Buffer.from(download .data));
48
+ fs.writeFileSync('${{ github.workspace }}/result.zip', Buffer.from(downloadResponse .data));
52
49
- name : Provide result directory
53
50
run : rmdir -rf result && mkdir -p result
54
51
- run : unzip -o result.zip -d result
0 commit comments