Skip to content

Commit 1cfb785

Browse files
committed
Workflow: Use GH API to download lh report artifact
1 parent 4c59709 commit 1cfb785

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/build-push.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,26 @@ jobs:
6868
console.log(`Success! Found the latest artifact with name ${artifactName}, with artifact id ${latestArtifact.id} | workflow id ${latestArtifact.workflow_run.id}`);
6969
core.setOutput("artifact_id", latestArtifact.id);
7070
core.setOutput("run_id", latestArtifact.workflow_run.id);
71+
72+
let download = await github.rest.actions.downloadArtifact({
73+
owner: owner,
74+
repo: repo,
75+
artifact_id: latestArtifact.id,
76+
archive_format: 'zip',
77+
});
78+
79+
let fs = require('fs');
80+
fs.writeFileSync('./artifact-lighthouse-report-main.zip', Buffer.from(download.data));
7181
}
7282
result-encoding: string
73-
- name: Download the artifact for main
74-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
75-
with:
76-
artifact-ids: ${{ steps.fetch-artifact-id.outputs.artifact_id }}
77-
run-id: ${{ steps.fetch-artifact-id.outputs.run_id }}
78-
path: ./main-report
83+
- name: Unzip the artifact
84+
run: |
85+
unzip ./artifact-lighthouse-report-main.zip
86+
ls -al
7987
- name: Move the main report artifact to same directory as pr report
8088
run: |
81-
ls -al ./main-report
82-
mv ./main-report/lighthouse-reports-main ./lighthouse-reports
89+
ls -al ./artifact-lighthouse-report-main
90+
mv ./artifact-lighthouse-report-main/lighthouse-reports-main ./lighthouse-reports
8391
- name: Compare the artifacts for negative differences in performance
8492
continue-on-error: true
8593
run: |

0 commit comments

Comments
 (0)