Skip to content

Commit 61680f4

Browse files
authored
Meta: Cleanup publish-pr.yml
1 parent eabe2e4 commit 61680f4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/publish-pr.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ jobs:
2525
with:
2626
script: |
2727
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);
3432
const { total_count, artifacts } = listArtifactsResponse.data;
3533
if (total_count !== 1) {
3634
const summary = artifacts?.map(artifact => {
@@ -40,15 +38,14 @@ jobs:
4038
const repr = value => JSON.stringify(value);
4139
throw Error(`Expected 1 artifact, got ${total_count} ${repr(summary ?? [])}`);
4240
}
43-
const artifactData = {
41+
const downloadResponse = await github.rest.actions.downloadArtifact({
4442
owner,
4543
repo,
4644
artifact_id: artifacts[0].id,
4745
archive_format: 'zip',
48-
};
49-
const download = await github.actions.downloadArtifact(artifactData);
46+
});
5047
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));
5249
- name: Provide result directory
5350
run: rmdir -rf result && mkdir -p result
5451
- run: unzip -o result.zip -d result

0 commit comments

Comments
 (0)